Challenge Overview
Start with the code from github:��https://github.com/smartsheet-platform/backup-java
1) Change the way the backup downloads attachments
Currently, the app asks for the attachment details during the sheet download process. ��These details include a link to Amazon S3 that is only valid for 2 minutes. This S3 URL gets thrown onto a worker pool and if the download worker doesn't execute within the 2 minute window, it will fail to download the file. ��To address this, the request to get the S3 URL should occur as part of the worker��process itself, increasing the likelihood that the 2-minute window will be met.
2) Graceful error handling
Add a config flag to config properties to indicate whether to continue on error, or to halt the process upon the first error. ��In the former case, produce a detailed��error log showing what was skipped. ��The error log��should have sufficient information such��that the user can determine who the sheet belongs to, what the sheet name is, the name of the attachment (if it was an attachment that failed), etc., so that manual steps can be taken to recover the item.
If the process generates at least one error, the last line of standard output should be a message indicating the an error occurred, and should include the location of the error log file.
Errors to consider:
- Any IO exceptions during the Sheet/Attachment download process
- Any unexpected errors coming from the API
- Any unexpected errors while writing to disk.
The bottom line:
- S3 attachment URL should be fetched within the worker job, immediately prior to downloading the attachment.
- Optional "continue on error" mode, including generation of a detailed error log and a very clear "error has occurred" message at the end of the standard output.
- The code should follow the style and patterns of the existing application, including being well-organized and well-commented.