Overview
Paper Channel uses pn-external-channel (also called CarrierPigeon) as the downstream system that physically dispatches paper mail. When a send request passes the prepare phase and a final delivery address is confirmed, Paper Channel hands off the shipment to External Channel over HTTP and then receives asynchronous progress events back through an SQS queue.Outbound: HTTP PUT
Paper Channel calls
sendPaperEngageRequest to submit a new paper delivery engagement.Inbound: SQS
External Channel pushes
PaperProgressStatusEvent events to the Paper Channel SQS queue.When Paper Channel calls External Channel
Paper Channel invokes External Channel in two scenarios:- Send phase — after the prepare phase resolves a valid delivery address, the service layer calls
ExternalChannelClient.sendEngageRequest(...)to submit the paper delivery request. - Notification rework — when a previously sent request must be re-opened, Paper Channel calls
ExternalChannelClient.initNotificationRework(requestIdx)to patch the request metadata.
Operations used
sendEngageRequest
Defined in ExternalChannelClient and implemented in ExternalChannelClientImpl.
Internally calls:
PaperMessagesApi.sendPaperEngageRequest(requestIdx, xPagopaExtchCxId, dto)— HTTP PUT to/external-channels/v1/paper-deliveries-engagements/{requestIdx}
initNotificationRework
Calls:
PaperRequestMetadataPatchApi.patchRequestMetadata(requestIdx, xPagopaExtchCxId, dto)withisOpenReworkRequest = true
Request fields — PaperEngageRequestDto
Unique identifier of the paper delivery request.
Identifier of the Public Administration that originated the notification. Can be overridden by
pn.paper-channel.request-pa-id-override.Postal product type (e.g.
AR, RS, 890, RIR).Recipient fiscal code.
Print specification for the physical letter.
Ordered list of document attachments. Each entry contains:
uri— the Safe Storage file key (cleaned viaAttachmentsConfigUtils.cleanFileKey)documentType—AAR(Avviso di Avvenuta Ricezione) orATTOsha256— SHA-256 checksum of the fileorder— zero-based ordering index
Full delivery address of the recipient.
Return address of the sender.
When
true, External Channel applies rasterization to attached PDFs before printing.Inbound SQS events
External Channel pushesPaperProgressStatusEvent events asynchronously to the queue configured in pn.paper-channel.queue-external-channel. Paper Channel processes these events in its queue consumer.
Key status codes
| Code | Meaning |
|---|---|
RECAG001A – RECAG015 | Raccomandata A/R (890 law) progress milestones |
RECRN001A – RECRN006C | Raccomandata Semplice / Normale progress milestones |
PNAG012 | Mandatory demat event for 890 products — triggers structured handling |
CON996 | Postal item taken in charge — retry-eligible event |
The set of status codes that allow automatic redrive after an OK is sent to Delivery Push is controlled by
pn.paper-channel.allowed-redrive-progress-status-codes (default: RECAG005C,RECAG006C,RECAG007C,RECAG008C).Configuration
| Property | Description | Example |
|---|---|---|
pn.paper-channel.client-external-channel-basepath | Base URL of the External Channel service | http://localhost:1080 |
pn.paper-channel.x-pagopa-extch-cx-id | Client identity header sent on every request | pn-cons-000 |
pn.paper-channel.queue-external-channel | SQS queue name for incoming status events | local-ext-channels-outputs |
pn.paper-channel.attempt-queue-external-channel | Max consumer retry attempts on the inbound queue | 3 |
pn.paper-channel.request-pa-id-override | Optional override for requestPaId in all engage requests | 15376371009 |
pn.paper-channel.enable-retry-con996 | Whether to retry on CON996 events | true |
pn.paper-channel.disabled-retry-send-engage-status-codes | Comma-separated status codes that must not trigger a retry send | (empty) |
Error handling
| Condition | Behaviour |
|---|---|
EXTERNAL_CHANNEL_API_EXCEPTION | Thrown when the HTTP call to External Channel fails. The error is logged and propagated upstream. |
EXTERNAL_CHANNEL_LISTENER_EXCEPTION | Thrown when the inbound SQS event cannot be processed. |
ERROR_NOT_FOUND_EXTERNAL_CHANNEL | Thrown when a requestId is not found on External Channel during a status check. |
HTTP 4xx / 5xx from External Channel | WebClientResponseException is caught; the response body is logged at ERROR level and the exception is re-emitted. |
All outbound calls are logged with
PnLogger.EXTERNAL_SERVICES.PN_EXTERNAL_CHANNELS at the async-invoke level so they appear in the structured audit trail.