Paper Channel uses pn-safe-storage to store and retrieve all document attachments associated with paper notifications — notification documents, F24 tax payment forms, and Avvisi di Avvenuta Ricezione (AAR). Safe Storage is a content-addressed, legally archiving blob store: every file is addressed by a fileKey, and files can be hot (immediately downloadable) or cold (requires a warm-up period).
Download
SafeStorageClient.getFile(fileKey) retrieves file metadata and a presigned download URL.
Upload
SafeStorageClient.createFile(...) reserves a presigned upload URL, then Paper Channel PUTs the content directly.
Prepare phase — attachment metadata (SHA-256, page count, document type) is fetched via getFile to validate each attachment before the send request is built.
ZIP / legal-facts upload — when Paper Channel generates a replica of external legal facts (PN_EXTERNAL_LEGAL_FACTS_REPLICA), it creates a new file in Safe Storage via createAndUploadContent.
Recursive retry on cold files — if Safe Storage returns a retryAfter hint, SafeStorageServiceImpl.getFileRecursive retries after the specified delay.
// SafeStorageService.javaString SAFESTORAGE_PREFIX = "safestorage://"; // prefix on stored fileKey valuesString ZIP_HANDLE_DOC_TYPE = "PN_EXTERNAL_LEGAL_FACTS_REPLICA"; // document type for zip replicasString SAVED_STATUS = "SAVED"; // status set when creating a file
getFileRecursive catches this and schedules a delayed retry
DOCUMENT_URL_NOT_FOUND
getFileRecursive exhausted all retries
Fatal error propagated upstream
DOCUMENT_NOT_DOWNLOADED
HTTP download of the presigned URL failed
Fatal error propagated upstream
WebClientResponseException
Non-2xx response from Safe Storage
Error body is logged; exception is re-emitted
ERROR_CODE_PAPERCHANNEL_ZIP_HANDLE
Failure during SHA-256 computation or file creation
Wrapped in PnGenericException and propagated
If attempt-queue-safe-storage is set to -1, the SQS consumer will retry indefinitely on Safe Storage events. Set a positive value in production to avoid infinite loops on persistent failures.