-
Notifications
You must be signed in to change notification settings - Fork 18
Sending Process
Philip Helger edited this page Feb 24, 2026
·
18 revisions
The sending process handles outbound Peppol document transmission from the Sender Backend (within C2) through the AP to the remote receiving AP (C3).
- Receive document via API - The Sender Backend provides data via the REST API (raw document + metadata, or pre-built SBD).
-
Store in database - The document and metadata are persisted to the
outbound_transactiontable in PostgreSQL. - Optional verification - Configurable validation of the document. May lead to rejection (status updated in DB, notification triggered).
- AS4 sending via phase4 - SMP lookup, SBDH creation (if needed), AS4 message construction, signing, and transmission. The synchronous AS4 receipt is checked.
-
Record sending attempt - Insert a row into
outbound_sending_attemptwith the outcome (AS4 Message ID, Receipt Message ID, HTTP status code, or error details). Update the parentoutbound_transactionstatus accordingly. -
On success: trigger outbound reporting - The
onSuccessfulAS4Sendingcallback triggers Peppol reporting for the outbound transaction. - On failure: schedule retry - The transaction is marked for retry. The retry strategy (max attempts, backoff) is defined via customizable Java interfaces.
- On permanent failure: notify - When max retries are exhausted, the generic notification interface is invoked.
┌────────┐ ┌──────────┐ ┌────────┐ ┌────────┐ ┌──────────┐
│Sender │ │ AP │ │ DB │ │ phase4 │ │ Remote │
│Backend │ │ API │ │ │ │ │ │ AP (C3) │
└───┬────┘ └────┬─────┘ └───┬────┘ └───┬────┘ └────┬─────┘
│ │ │ │ │
│ 1. Submit doc │ │ │ │
│ (raw+meta or SBD)│ │ │ │
│─────────────────>│ │ │ │
│ │ │ │ │
│ │ 2. Insert into │ │ │
│ │ outbound_ │ │ │
│ │ transaction │ │ │
│ │─────────────────>│ │ │
│ │ stored OK │ │ │
│ │<─────────────────│ │ │
│ │ │ │ │
│ │ 3. Verify doc │ │ │
│ │ (optional) │ │ │
│ │──────┐ │ │ │
│ │ │ validate │ │ │
│ │<─────┘ │ │ │
│ │ │ │ │
│ │ [if rejected: update DB, notify, return error] │
│ │ │ │ │
│ │ 4. Trigger AS4 │ │ │
│ │ send │ │ │
│ │─────────────────────────────────── >│ │
│ │ │ │ │
│ │ │ │ AS4 UserMessage │
│ │ │ │─────────────────>│
│ │ │ │ │
│ │ │ │ AS4 Receipt │
│ │ │ │<─────────────────│
│ │ │ │ │
│ │ AS4 result │ │ │
│ │ (Receipt MsgID, │ │ │
│ │ HTTP status) │ │ │
│ │<────────────────────────────────────│ │
│ │ │ │ │
│ │ 5. Insert into │ │ │
│ │ outbound_ │ │ │
│ │ sending_attempt │ │ │
│ │─────────────────>│ │ │
│ │ │ │ │
│ │ Update outbound_ │ │ │
│ │ transaction │ │ │
│ │ status │ │ │
│ │─────────────────>│ │ │
│ │ │ │ │
│ API response │ │ │ │
│ (queued/not │ │ │ │
│ queued + │ │ │ │
│ SBDH Instance │ │ │ │
│ ID) │ │ │ │
│<─────────────────│ │ │ │
│ │ │ │ │
│ │ 6. [on success] │ │ │
│ │ Trigger outbound│ │ │
│ │ reporting │ │ │
│ │ callback │ │ │
│ │──────┐ │ │ │
│ │ │ report │ │ │
│ │<─────┘ │ │ │
│ │ │ │ │
│ │ Store reporting │ │ │
│ │ record │ │ │
│ │─────────────────>│ │ │
│ │ │ │ │
┌──────────┐ ┌────────┐ ┌────────┐ ┌──────────┐
│Scheduler │ │ DB │ │ phase4 │ │ Remote │
│ │ │ │ │ │ │ AP (C3) │
└────┬─────┘ └───┬────┘ └───┬────┘ └────┬─────┘
│ │ │ │
│ Query outbound_ │ │ │
│ transaction where │ │ │
│ status = failed │ │ │
│───────────────────>│ │ │
│ │ │ │
│ list of pending │ │ │
│<───────────────────│ │ │
│ │ │ │
│ For each: │ │ │
│ │ │ │
│ Trigger AS4 send │ │ │
│───────────────────────────────────────>│ │
│ │ │ AS4 UserMessage │
│ │ │───────────────────>│
│ │ │ AS4 Receipt/Error │
│ │ │<───────────────────│
│ AS4 result │ │ │
│<───────────────────────────────────────│ │
│ │ │ │
│ Insert sending │ │ │
│ attempt row │ │ │
│───────────────────>│ │ │
│ │ │ │
│ Update outbound_ │ │ │
│ transaction status │ │ │
│───────────────────>│ │ │
│ │ │ │
│ [on success: │ │ │
│ trigger reporting │ │ │
│ callback] │ │ │
│ │ │ │
│ [if max retries │ │ │
│ exhausted: notify]│ │ │
│ │ │ │
| Field | Description |
|---|---|
| SBDH Instance ID | The Peppol SBDH Instance Identifier |
| Business Document ID | Optional: the ID from the business document itself |
| Document bytes | The raw document payload |
| C1 Country Code | Country of the sender (C1), provided via API or extracted from SBDH |
| Transaction Status | Current state (pending, sending, sent, failed, permanently_failed) |
| Created timestamp | When the transaction was initially created |
| Reporting status | Whether outbound reporting has been triggered (pending, reported) |
| Field | Description |
|---|---|
| Outbound Transaction ID | FK to the parent outbound transaction |
| AS4 Message ID | The AS4 Message ID used for this attempt |
| Receipt Message ID | The AS4 Message ID from the synchronous receipt (null on failure) |
| HTTP Status Code | The HTTP status code from the AS4 response |
| Attempt timestamp | Date and time of this sending attempt |
| Attempt status | Outcome of this attempt (success, failed) |
| Error details | Error message or reason for failure (null on success) |
It is appreciated if you star the GitHub project if you like it.
Donation link: https://paypal.me/PhilipHelger
- Home
- News and noteworthy
- Running phoss AP
- Architecture Overview
- API Specification
- Configuration Properties
- Code Lists
- Database Design Notes
- Maven Module Structure
- Runtime Extensions
- OpenTelemetry Integration
- Security Considerations
- Peppol Specifics
- Testing Without Peppol Network
- Known Users
- Migrating from phase4-peppol-standalone
- Contributing