- The actual exchange and queue names (
clouderp-sync-queue,clouderp-delivery-queue,clouderp-sync-response-queue) and the exchange-to-exchange binding of the delivery queue — the dotted names from v1.0 do not exist on the broker. - The correct wire format: the envelope and
SynchronizationMessageare camelCase, PascalCase applies only inside thedatafield; deliveries and ACKs are MassTransit envelopes. - Entities
PeppolDocument= 30 andPeppolDocumentEvent= 32 (v1.0 stated 100) and the new chapter 7. Send result — the only way to find out whether a document has actually gone out to Peppol. - Registration API:
Authorizationheader with the raw key,Registration/Validateresponse in camelCase; multiple sites andsuffixRoutingKey. - The exact content of a received document (SBDH envelope, canonical identifiers), deduplication, party checks, retry policies, cases with no response and corrected examples in Java, .NET and Python.
Chapter 1How the integration works
1.1 Big picture
Your system never communicates with APEX directly. During onboarding you use the REST API of the QHUB registration service; at runtime you only use AMQP 0-9-1 (RabbitMQ). QHUB delivers your documents to APEX, and APEX sends you both received documents and send results through QHUB.
1.2 The three message types you exchange
| Message | entityType | Direction | What it carries |
|---|---|---|---|
PeppolDocument | 30 | both directions | UBL document + Peppol identifiers (a document being sent or received) |
PeppolDocumentEvent | 32 | APEX → your system only | business outcome of a document you sent: queued, delivered, rejected, dead letter, MLS |
SynchronizationResponseMessage (ACK) | – | message recipient → QHUB | technical confirmation “I have processed the message” |
An ACK is not a result. An ACK only means “I have received the message”. Whether a document has actually gone out to Peppol you learn exclusively from
PeppolDocumentEvent(chapter 7). APEX does not report business rejections (validation, license, unknown sender) via ACK at all.
1.3 What QHUB does for you — and what it does not
- Registrations and binding authorization — the pair (your system, tenant) ↔ (APEX, tenant) must be registered in QHUB; QHUB does not let an unregistered binding through.
- Routing — based on the routing key, QHUB delivers messages from your system to APEX and back; you do not need to know where APEX runs.
- Audit — every message is recorded in the QHUB transaction table with its status and time.
QHUB does not redeliver messages and moves nothing to a DLQ. If no ACK arrives, the transaction in QHUB stays in the Pending state — no further attempt and no notification follow. Dead-lettering is a property of your queue (chapter 10.9) and monitoring it is your responsibility.
1.4 What you need to do
| Area | Your responsibility |
|---|---|
| Topology | Declare your own delivery exchange and queue with their bindings (chapter 4). |
| Receiving (Peppol → your system) | Consume deliveries, unwrap both the envelope and the SBDH, import the UBL and always send an ACK. |
| Sending (your system → Peppol) | Prepare the UBL, publish a SynchronizationMessage with the PeppolDocument entity to clouderp-sync-queue. |
| Tracking the result | Consume PeppolDocumentEvent from the same queue and keep track of the document status. |
| Idempotency and monitoring | Deduplicate deliveries (QHUB does not guarantee exactly-once), use unique identifiers, and have timeouts and alerts for documents without a response. |
Chapter 2Prerequisites and onboarding
2.1 What must be in place before you start
- The customer (tenant) exists in APEX. It is linked to an IAM tenant UUID in ASOL Cloud — this is the
TenantIdyou use everywhere (participantTenantId,ownerTenantId, routing key). It is not the internal ID of your ERP. If you serve several customers, each has its ownTenantId, its own routing key and its own queue. - Valid ALIS licenses on the same tenant — for APEX and for your system (
SystemCode), both with a serial number. Without them the registration in QHUB cannot be created. (Multi-tenant systems in the QHUB catalog do not need their own license; QHUB checks it when validating the key.) - QHUB knows your system — your
SystemCodeappears in the QHUB catalog after you submit the entity description (3.1). - The sender is a participant of your tenant. The Peppol participant you send on behalf of (e.g.
0245:2024000001) must be registered in APEX and assigned to the tenant fromownerTenantId. ASOL registers it (e.g. during SMP registration); APEX does not create an unknown sender on its own. - An AMQP 0-9-1 client with TLS 1.2+ support:
- Java: Spring AMQP / RabbitMQ Java Client
- .NET: RabbitMQ.Client (MassTransit v9 is commercial; v8 is open source)
- Python: pika
- Node.js: amqplib
2.2 What you receive from ASOL or your partner
| Item | Note |
|---|---|
SystemCode | The code of your system in QHUB/ALIS (e.g. MYERP). |
TenantId | The customer's IAM tenant UUID — separate for each customer. |
| Site serial number | Only if the customer has several installations (sites) of the same system — 3.4. |
| QHUB registration service URL + API key | For writing the entity description (3.1). |
| One-time registration key | Generated by an ASOL admin or a partner for a specific registration; it is shown once and APEX does not store it. Each new key invalidates the previous one and disconnects the paired system until you enter the new one. According to the QHUB documentation it is valid for 24 hours. |
| Broker CA certificates | The broker certificate is issued by the private Asseco Solutions CA — add its certificates (intermediate and root) to your truststore. |
| Client certificate (mTLS) | Only if the environment requires it. It arrives as an encrypted ZIP (ca.pem, client_cert.pem, client_key.pem, client.pfx), with the password sent through another channel. The certificate complements the key, it does not replace it. |
2.3 Onboarding step by step
| # | Step | Who |
|---|---|---|
| 1 | ALIS licenses for APEX and your system for the customer's tenant; participant registration (SMP) | ASOL / partner |
| 2 | Submitting the description of the PeppolDocument (30) and PeppolDocumentEvent (32) entities to the QHUB catalog | you |
| 3 | Creating the APEX ↔ your system registration (per site, if applicable) | ASOL / partner |
| 4 | Generating the one-time registration key and handing it over securely | ASOL / partner |
| 5 | POST /api/v1/Registration/Validate → RabbitMQ URL, user name and password | you |
| 6 | Installing the CA certificate (and the client certificate, if mTLS is used) | you |
| 7 | Declaring the delivery exchange, queue and bindings; starting the consumer | you |
| 8 | Receiving + ACK, sending, event processing, deduplication, timeouts | you |
| 9 | Testing inbound, outbound and negative scenarios in the test environment | you + ASOL |
Chapter 3System registration in QHUB
Registration has three parts: the entity description (done by you), the registration binding (done by ASOL or a partner) and key validation (done by you).
3.1 Submitting the entity description
QHUB must know which entities your system supports. For Peppol there are two entities: PeppolDocument (the document) and PeppolDocumentEvent (the processing result). QHUB only routes entities that both sides have registered — without entity 32 the events have nowhere to go.
Endpoint:
POST {QHUB_REGISTRATION_URL}/api/v1/SyncEntityCatalogItem Content-Type: application/json Accept: application/json Authorization: {API key}
Authorizationcontains the raw API key without a prefix (noBearerand noBasic). TheX-Api-Keyheader is not supported. Older QHUB documentation also mentions the path/api/v1/SyncEntityCatalogItem/StoreSyncEntityItems; use the shorter form, which APEX uses as well.
Request body — the same definition that APEX registers (the names and Required flags must match on both sides):
{
"System": "MYERP",
"SyncEntityDatas": [
{
"EntityCode": "PeppolDocument",
"EntityType": 30,
"DefaultAllowed": true,
"Version": "1.0.0",
"SyncEntityDefinitionData": {
"SyncPropertiesData": [
{ "Name": "SenderParticipantId", "OriginalName": "SenderParticipantId", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "ReceiverParticipantId", "OriginalName": "ReceiverParticipantId", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "DocumentTypeId", "OriginalName": "DocumentTypeId", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "ProcessId", "OriginalName": "ProcessId", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "UblDocument", "OriginalName": "UblDocument", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "As4MessageId", "OriginalName": "As4MessageId", "ProperyType": "String", "Required": false, "IsBusinessKey": true },
{ "Name": "ReceivedAt", "OriginalName": "ReceivedAt", "ProperyType": "DateTime", "Required": false, "IsBusinessKey": false }
],
"SyncForeignKeysData": []
}
},
{
"EntityCode": "PeppolDocumentEvent",
"EntityType": 32,
"DefaultAllowed": true,
"Version": "1.0.0",
"SyncEntityDefinitionData": {
"SyncPropertiesData": [
{ "Name": "EventId", "OriginalName": "eventId", "ProperyType": "String", "Required": true, "IsBusinessKey": true },
{ "Name": "PeppolDocumentMessageCorrelationId", "OriginalName": "peppolDocumentMessageCorrelationId", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "EventType", "OriginalName": "EventType", "ProperyType": "String", "Required": true, "IsBusinessKey": false },
{ "Name": "Message", "OriginalName": "Message", "ProperyType": "String", "Required": false, "IsBusinessKey": false },
{ "Name": "Error", "OriginalName": "Error", "ProperyType": "String", "Required": false, "IsBusinessKey": false },
{ "Name": "ValidationErrors", "OriginalName": "ValidationErrors", "ProperyType": "String", "Required": false, "IsBusinessKey": false },
{ "Name": "ValidationWarnings", "OriginalName": "ValidationWarnings", "ProperyType": "String", "Required": false, "IsBusinessKey": false },
{ "Name": "Timestamp", "OriginalName": "Timestamp", "ProperyType": "DateTime", "Required": true, "IsBusinessKey": false }
],
"SyncForeignKeysData": [
{ "Name": "PeppolDocumentKey", "EntityType": 30, "Required": true }
]
}
}
]
}ProperyType— yes, without the secondt; that is the field name in the QHUB API.EntityType— the values 30 and 32 are fixed by the QHUB code list. APEX rejects any other number (UnsupportedEntityType).SyncForeignKeysDataforPeppolDocumentEventdeclares thePeppolDocumentKeyreference to entity 30 — you use it to pair an event with its document.Version— send"1.0.0"(the same asschemaVersionin messages). QHUB only picks up a catalog change when the version changes.- Success:
HTTP 200, bodytrue. Submitting it again (e.g. at application startup) is harmless.
3.2 Registration binding (created by ASOL or a partner)
The registration between APEX and your system for a specific customer is not created by you through the API. It is created by:
- an ASOL admin in APEX Management (notifications section, “New QHub registration” and “Generate key”),
- a partner in the same interface or through the Partner API (
POST /partner-api/v1/customers/{customerId}/qhub/registrationsandPOST /partner-api/v1/qhub/registrations/{id}/key), - for QASIDA ERP and HOREC also the customer portal.
The registration links the owner APEX and your SystemCode on the same IAM tenant of the customer, with the license serial numbers and optionally a validity period. A registration cannot be edited — it is changed by deleting it and creating a new one (deletion also invalidates the key). When the license or the period expires, QHUB invalidates it during its nightly check.
3.3 Validating the registration key
You receive the one-time registration key through a secure channel. You exchange it for access to RabbitMQ:
POST {QHUB_REGISTRATION_URL}/api/v1/Registration/Validate Content-Type: application/json
{
"participantSystem": "MYERP",
"participantTenantId": "c0ffee00-1111-2222-3333-444455556666",
"registrationKey": "REG-KEY-FROM-ASOL",
"routingKey": "MYERP.c0ffee00-1111-2222-3333-444455556666"
}
routingKeyidentifies your instance. The convention for systems outside ASOL Cloud is{SystemCode}.{TenantId}. It is case-sensitive and the names of your delivery exchange and queue are derived from it — use it identically everywhere.
Successful response (HTTP 200) — in camelCase:
{
"participantSystem": "MYERP",
"participantTenantId": "c0ffee00-1111-2222-3333-444455556666",
"rabbitMqUrl": "amqps://messaging.qasida.sk:5671",
"rabbitMqName": "myerp_c0ffee00",
"rabbitMqPass": "••••••••••••",
"errorCode": null,
"success": true,
"registeredEntities": [ … ]
}- Parse it as camelCase. With PascalCase the client does not crash, but you get
success = falseand nothing butnulls. rabbitMqUrlspecifies the host (messaging.qasida.sk), the port (AMQPS 5671) and possibly the virtual host — the value from the response is always authoritative. If it arrives with thehttps://scheme, useamqps://.rabbitMqPassis a secret — store it in a vault (Kubernetes Secret, Vault…), never in a repository. QHUB creates the user and permissions on the broker automatically.registeredEntitiesdescribes the allowed entities and routing; verify its exact structure against a real response.- Error codes: 10.2.
3.4 Multiple customers and multiple sites
- Multiple customers: each customer (tenant) has its own
TenantId, its own registration, its own routing key and its own delivery queue. - Multiple installations at one customer (e.g. sites with their own installation of the system): each gets its own registration, distinguished by the license serial number of the site. A registration is uniquely identified by the triple tenant +
SystemCode+ serial number; without a serial number a tenant can have only one registration for a given system. The key is entered in the installation of the respective site. suffixRoutingKey(since October 2026): if documents of one tenant are sent by different sites, extend theSynchronizationMessageyou send with thesuffixRoutingKeyfield (e.g. the site serial number; at most 128 characters, no dot and no control characters). APEX stores it and returns it in the envelope of everyPeppolDocumentEventfor that document; if the target application has suffix-based routing enabled in QHUB, the event arrives in the queue of the site that sent the document. Documents without a suffix and all documents received from Peppol go to the tenant's base queue. Agree the exact name of the site queue and the routing setup with ASOL.
Chapter 4RabbitMQ connection setup
The QHUB broker runs at messaging.qasida.sk. The connection uses AMQPS (TLS, port 5671) with the URL, user name and password from Registration/Validate. Allow outbound connections to messaging.qasida.sk:5671 and verify reachability from your environment with ASOL during onboarding.
4.1 Topology — exchanges and queues
The names are literal AMQP identifiers, including the hyphens. Three of them are exchanges, even though their names contain “queue”.
| Name | Type | Declared by | Purpose |
|---|---|---|---|
clouderp-sync-queue | fanout exchange | QHUB (exists) | You publish documents to be sent (routing key "") |
clouderp-sync-response-queue | fanout exchange | QHUB (exists) | You publish ACKs (routing key "") |
clouderp-delivery-queue | direct exchange | QHUB (exists) | Central exchange to which QHUB publishes deliveries with the recipient's routing key |
clouderp-delivery-queue.{RoutingKey} | fanout exchange | you | Your per-instance exchange |
clouderp-delivery-queue.{RoutingKey} | queue | you | Your delivery queue — this is where you read from |
clouderp.dlq | dead-letter exchange | — (verify with ASOL) | Target for messages that your queue dead-letters |
Dotted names do not exist.
clouderp.sync,clouderp.sync.responseandclouderp.deliveryare not on the broker (publishing to them ends with404 NOT_FOUND). The only object with dots isclouderp.dlq. The exchange and the queueclouderp-delivery-queue.{RoutingKey}have the same name — in RabbitMQ these are separate namespaces.
4.2 How it fits together
YOU publish a document YOU read deliveries and events
│ ▲
▼ │
┌──────────────────────┐ ┌────────────────────────────────────┐
│ clouderp-sync-queue │ │ queue clouderp-delivery-queue.{RK} │
│ (fanout exchange) │ └─────────────────▲──────────────────┘
└──────────┬───────────┘ │ binding (fanout, "")
▼ ┌─────────────────┴──────────────────┐
┌───────────┐ │ fanout exchange │
│ QHUB │──────────────────────────▶│ clouderp-delivery-queue.{RK} │
│ Sync Svc │ publishes to └─────────────────▲──────────────────┘
└─────▲─────┘ clouderp-delivery-queue │ exchange-to-exchange
│ (direct, routing key = {RK}) │ binding, routing key = {RK}
│ ┌─────────────────┴──────────────────┐
│ │ direct exchange │
│ │ clouderp-delivery-queue │
│ └────────────────────────────────────┘
┌──────────┴───────────────────┐
│ clouderp-sync-response-queue │ ◀── YOU publish the ACK
│ (fanout exchange) │
└──────────────────────────────┘Key point: your queue is not bound directly to clouderp-delivery-queue. The chain is clouderp-delivery-queue (direct, routing key = {RoutingKey}) → your fanout exchange → your queue.
4.3 Permissions of your RabbitMQ account
QHUB creates the user and permissions when the key is validated — you do not set anything up on the broker. For reference, this is what the individual operations require:
| Operation | Permission |
|---|---|
| Declaring your own exchange and queue | configure on clouderp-delivery-queue.{RoutingKey} |
| Queue with a dead-letter exchange | write on clouderp.dlq |
| Binding queue → your exchange | write on the queue, read on your exchange |
| Exchange-to-exchange binding | write on your exchange, read on clouderp-delivery-queue |
| Consuming | read on your queue |
| Publishing documents and ACKs | write on clouderp-sync-queue and clouderp-sync-response-queue |
If anything fails with ACCESS_REFUSED, contact ASOL.
4.4 Declaring the topology
Your exchange, queue and bindings are declared by your system before the first consume. Declarations are idempotent — run them at every startup.
1) fanout exchange clouderp-delivery-queue.{RoutingKey} durable=true, auto-delete=false
2) queue clouderp-delivery-queue.{RoutingKey} durable=true, exclusive=false, auto-delete=false
arguments: x-dead-letter-exchange = clouderp.dlq
3) queue binding queue clouderp-delivery-queue.{RoutingKey} ← exchange clouderp-delivery-queue.{RoutingKey}
routing key ""
4) exchange binding destination clouderp-delivery-queue.{RoutingKey} (EXCHANGE)
source clouderp-delivery-queue (direct)
routing key {RoutingKey}- Step 4 is an exchange-to-exchange binding (raw AMQP
exchange.bind(destination, source, routingKey), Springnew Binding(dest, DestinationType.EXCHANGE, source, rk, null)). Without it the queue is created, but nothing ever arrives in it. - Do not declare the central exchanges (
clouderp-sync-queue,clouderp-delivery-queue,clouderp-sync-response-queue) — they exist, and declaring them requires the configure permission, which your account does not have (ACCESS_REFUSED). If you want to verify them, use a passive declaration. - Do not change the queue arguments. Redeclaring with different arguments (e.g. without a DLX) ends with
PRECONDITION_FAILED.
4.5 TLS and mTLS
- TLS is mandatory (
amqps://, port 5671), TLS 1.2 or higher. The broker certificate (valid formessaging.qasida.sk) is issued by the private Asseco Solutions CA — you receive the CA certificates (PEM, intermediate and root) from ASOL; add them to your truststore. Do not disable hostname verification. - mTLS depends on the environment. If ASOL enables it, you receive a client certificate and key (PEM, both PKCS#1 and PKCS#8, or
client.pfx); use RSA keys. The certificate is presented in addition to the user name and password, it does not replace them.
4.6 Recommended consumer settings
| Setting | Value | Why |
|---|---|---|
| prefetch | 10 | keeps memory under control |
| acknowledgement | manual/AUTO after a successful save | acknowledge the message only after it has been durably stored |
| requeue on error | false | on an exception the message goes to the DLX instead of looping forever |
| message conversion | raw bytes, no type converter | a delivery is a MassTransit envelope; e.g. Spring Jackson2JsonMessageConverter fails on the __TypeId__ header and the message ends up in the DLQ |
| processing | persist-then-process | in the listener only store the raw JSON, process it asynchronously from your own table |
Message size: the entire UBL document including attachments (Base64 in
cac:AdditionalDocumentReference) travels in a single AMQP message. The limit is set by the broker configuration (the RabbitMQ default is 16 MiB) — for large attachments, verify the actual limit with ASOL.
Chapter 5Receiving documents from Peppol
When APEX receives a Peppol document for your customer, QHUB delivers it to your delivery queue as a SynchronizationMessage with the PeppolDocument entity (entityType = 30).
5.1 Receiving flow
Peppol sender → AS4 → APEX
→ validation (XSD + Schematron) and storage; the sender receives a Peppol MLS
→ valid documents only: APEX publishes a SynchronizationMessage to clouderp-sync-queue (within approx. 5 s)
→ QHUB creates a delivery for each registered target system of the tenant
→ clouderp-delivery-queue (direct, routing key = your RoutingKey)
→ clouderp-delivery-queue.{RoutingKey} (your fanout exchange) → your queue
→ YOUR CONSUMER → import → ACK to clouderp-sync-response-queue- All valid received documents of the tenant are delivered: invoices, credit notes, self-billing invoices, orders, and also business responses (Invoice Response / IMR, MLR).
- Not delivered: documents rejected by validation, technical Peppol MLS and duplicate AS4 messages.
- If no registration exists for the tenant, QHUB skips the delivery.
5.2 Format of a delivered message
A delivery is a MassTransit envelope (content-type: application/vnd.masstransit+json). The payload is in the message field:
{
"messageId": "8f14e45f-ceea-467a-9575-9c4b9b8a1c3d",
"correlationId": "3b2f1c0a-9d8e-4f7a-b6c5-1a2b3c4d5e6f",
"messageType": [
"urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage"
],
"sentTime": "2026-10-09T08:15:31.1234567Z",
"headers": {},
"host": { "machineName": "…", "processName": "…", "massTransitVersion": "…" },
"message": {
"transactionId": 4711,
"eventType": 1,
"entityType": 30,
"routingKey": "MYERP.c0ffee00-1111-2222-3333-444455556666",
"ownerTenantId": "c0ffee00-1111-2222-3333-444455556666",
"ownerSystem": "APEX",
"deliverySystem": "MYERP",
"deliveryTenantId": "c0ffee00-1111-2222-3333-444455556666",
"syncKey": "abc123@ap.sender.example",
"schemaVersion": "1.0.0",
"environment": "…",
"domainSyncVersion": 1,
"occurredAt": "2026-10-09T08:15:30.5Z",
"data": "{\"SenderParticipantId\":\"iso6523-actorid-upis::0245:2024000002\", … ,\"UblDocument\":\"<StandardBusinessDocument …>…\"}",
"ignoredProperties": null,
"suffixRoutingKey": null
}
}Two conventions in one message. Both the envelope and
messageare in camelCase; the content of thedatafield is in PascalCase.datais a JSON string — deserialize it a second time.
eventTypeandentityTypemay arrive as a number or as a string (30,"30", or a name) — your deserializer must cope with that.- Ignore unknown fields; QHUB and MassTransit may add more.
routingKey,ownerSystemanddeliverySystemare filled in by QHUB during routing; the values in the example are illustrative.- For a received document,
syncKeyis the AS4 MessageId from the sending access point (not a UUID). - Your queue may also receive an envelope whose
messageTypecontains…:SynchronizationResponseMessage(ACK). It carries no entity — acknowledge it at the RabbitMQ level, do not store it and do not send an ACK for it.
5.3 PeppolDocument content of a received document
| Field | Content |
|---|---|
SenderParticipantId, ReceiverParticipantId | Always in the canonical form iso6523-actorid-upis::0245:2024000002. When comparing, strip everything up to and including ::. |
DocumentTypeId | The document type from the AS4 header; usually with the scheme prefix busdox-docid-qns:: — remove it before comparing. |
ProcessId | The process without the scheme, e.g. urn:fdc:peppol.eu:2017:poacc:billing:01:1.0. |
UblDocument | The entire StandardBusinessDocument (SBDH envelope with the UBL document inside) as XML text, not Base64. Locate the business document by its namespace (e.g. urn:oasis:names:specification:ubl:schema:xsd:Invoice-2); prefixes are not guaranteed. An empty string means the payload could not be loaded — treat it as an error. |
As4MessageId | The AS4 MessageId assigned by the sending access point (the format is up to it, e.g. uuid@domain). |
ReceivedAt | Time of receipt in APEX, ISO 8601 with offset. |
Attachments are part of the UBL (cac:AdditionalDocumentReference/cac:Attachment/cbc:EmbeddedDocumentBinaryObject); there is no separate attachment channel.
5.4 What to do with each delivery
- Store the raw bytes/JSON in your own table (persist-then-process).
- Only log empty bodies, envelopes without
messageand ACK envelopes, and acknowledge them at the RabbitMQ level. - Deduplicate (5.6).
- Branch on
entityType: 30 → import the document (unwrap the SBDH, normalize identifiers), 32 → update the status of the sent document (chapter 7), anything else → log it. - Send an ACK for every processed delivery — both on success and on error.
5.5 Response ACK (required)
You publish the ACK to the clouderp-sync-response-queue exchange with routing key "". It must be a MassTransit envelope — the QHUB response endpoint rejects plain application/json:
| Property | Value |
|---|---|
content-type | application/vnd.masstransit+json |
header MT-MessageType | urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage |
messageId (in the body) | GUID, the same when retrying the same ACK (e.g. derived from correlationId and transactionId) |
correlationId (in the body) | copied from the delivery |
message.transactionId | copied from the delivery (message.transactionId) |
{
"messageId": "5d0b3c9e-2f7a-5c1b-9e44-0a6f2d1c8b77",
"correlationId": "3b2f1c0a-9d8e-4f7a-b6c5-1a2b3c4d5e6f",
"messageType": [
"urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage"
],
"sentTime": "2026-10-09T08:15:35Z",
"message": {
"transactionId": 4711,
"result": { "success": true, "errorCode": null, "errorParams": null }
}
}On error: "result": { "success": false, "errorCode": "ImportFailed", "errorParams": ["INV-2026-001"] }. Put only the parameters of the error code into errorParams (they are used to compose the translated texts), not exception texts.
- Always send an ACK, also on error and also for events (entity 32).
- If
transactionIdis missing or0, QHUB has nothing to match the ACK to — do not send it. - If publishing the ACK fails, retry until it succeeds (APEX does this with backoff 30 s → 60 s → 120 s → 240 s → max 300 s, with no limit on attempts). QHUB does not resend a delivery without an ACK — the transaction would be left hanging.
5.6 Deduplication (required)
QHUB does not guarantee exactly-once delivery. Detect duplicates using these keys (APEX checks the first three on its side):
| Key | When |
|---|---|
message.transactionId | if greater than 0 |
envelope correlationId | if filled in |
As4MessageId from data | for entity 30 — the content identity of the received document |
EventId from data | for entity 32 |
Back the application check with a unique index in the database — with parallel consumers, the check alone is subject to race conditions.
5.7 Business rejection of a received invoice
APEX confirms technical receipt (Peppol MLS) to the sending access point right after storing the document, regardless of the outcome of your import. A negative ACK to QHUB only marks the transaction — the invoice sender never learns about it. If you want to reject or accept the invoice at the business level, send them an Invoice Response (IMR) as a regular outgoing PeppolDocument (chapter 6, identifiers in Appendix A).
Chapter 6Sending documents to Peppol
To send a document, publish a SynchronizationMessage with the PeppolDocument entity to the clouderp-sync-queue exchange. QHUB delivers it to APEX, which checks it, queues it and sends it via AS4. The result comes back to you as a PeppolDocumentEvent.
6.1 Sending flow
YOUR SYSTEM → SynchronizationMessage (entityType 30) → clouderp-sync-queue
→ QHUB → APEX's delivery queue
→ APEX (processing every ~3 s): checks 1–10 (6.4)
├─ rejection → PeppolDocumentEvent VALIDATION_ERROR / LICENSE_ERROR / AUTHORIZATION_ERROR / PROCESSING_ERROR
└─ acceptance → MESSAGE_QUEUED (+ ACK to QHUB)
→ AS4 sending with retries → MESSAGE_DELIVERED | QUEUE_PROCESSING_FAILED … | QUEUE_DEAD_LETTER
→ later, possibly MLS_RECEIVED / MLS_RECEIVED_NEGATIVE
APEX → PeppolDocumentEvent (entityType 32) → QHUB → your delivery queue (or the site queue when suffixRoutingKey is used)6.2 Format of the outgoing message
Difference from a delivery: what you send to
clouderp-sync-queueis a bareSynchronizationMessageat the JSON root, not a MassTransit envelope (QHUB uses a raw JSON deserializer here).
| AMQP property | Value |
|---|---|
| exchange / routing key | clouderp-sync-queue / "" |
content-type | application/json |
header MT-MessageType | urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage |
message_id | GUID — the same when republishing the same message |
correlation_id | GUID — unique for each document (reusing it can cause APEX to discard a later document as a duplicate) |
| delivery mode | persistent |
{
"transactionId": 0,
"eventType": 1,
"entityType": 30,
"routingKey": null,
"ownerTenantId": "c0ffee00-1111-2222-3333-444455556666",
"ownerSystem": "MYERP",
"deliverySystem": null,
"deliveryTenantId": "c0ffee00-1111-2222-3333-444455556666",
"syncKey": "9a1d2c3e-6b7f-4c8d-9e0a-1b2c3d4e5f60",
"schemaVersion": "1.0.0",
"environment": "Production",
"domainSyncVersion": 1,
"occurredAt": "2026-10-09T08:15:30Z",
"data": "{\"SenderParticipantId\":\"0245:2024000001\",\"ReceiverParticipantId\":\"0245:2024000002\",\"DocumentTypeId\":\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1\",\"ProcessId\":\"urn:fdc:peppol.eu:2017:poacc:billing:01:1.0\",\"UblDocument\":\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><Invoice xmlns=…>…</Invoice>\"}",
"ignoredProperties": null,
"suffixRoutingKey": "SN-001"
}| Field | What to put there |
|---|---|
transactionId | 0 — QHUB assigns its own |
eventType | always 1. APEX does not evaluate eventType — both 2 (UPDATE) and 4 (DELETE) would mean a new, irreversible send to Peppol |
entityType | 30 |
routingKey, deliverySystem | null — filled in by QHUB |
ownerTenantId | The customer's IAM tenant UUID; APEX uses it to find the tenant and the license and to verify the sender |
ownerSystem | your SystemCode (ASOL confirms the exact form during onboarding) |
deliveryTenantId | tenant UUID or null (APEX does not use it) |
syncKey | a new UUID for each document; QHUB skips a second message with the same syncKey and version. It comes back to you in the event as PeppolDocumentKey.SyncKey — store it |
schemaVersion | "1.0.0" — the same as Version in the catalog |
environment | the environment label agreed during onboarding (APEX does not check it) |
domainSyncVersion | 1 (≥ 1); this is not a conflict-resolution mechanism |
occurredAt | time of creation on your side, ISO 8601 string |
data | the PeppolDocument entity as a JSON string in PascalCase |
suffixRoutingKey | optional — site label, so that events arrive in that site's queue (3.4) |
6.3 PeppolDocument entity fields when sending
| Field | Required | Rules |
|---|---|---|
SenderParticipantId | yes | Short (0245:2024000001) or canonical form. Must be registered in APEX under the tenant from ownerTenantId and match the cbc:EndpointID of the sending party in the document (6.4). |
ReceiverParticipantId | yes | Same forms. Must be discoverable in Peppol (SML/SMP) for the given document type and process and match the cbc:EndpointID of the receiving party. |
DocumentTypeId | yes | Full Peppol identifier, with or without the busdox-docid-qns:: scheme (Appendix A). |
ProcessId | yes | Peppol process, e.g. urn:fdc:peppol.eu:2017:poacc:billing:01:1.0. |
UblDocument | yes | XML text in UTF-8 (not Base64) — bare UBL or UBL in an SBDH. APEX strips a leading BOM. |
As4MessageId | leave empty | This is the APEX deduplication key — a repeated value makes APEX silently discard the document. |
ReceivedAt | leave empty | If you fill it in, it must be a valid ISO 8601 time with offset; otherwise the message cannot be processed and no event arrives. |
6.4 Checks in APEX and party rules
APEX performs the checks in this order; the first failure rejects the document and sends an event (no ACK):
| # | Check | EventType | Error |
|---|---|---|---|
| 0 | data is not valid JSON or cannot be mapped (e.g. an invalid ReceivedAt) | no event; after 3 attempts a failure ACK ProcessingFailed | — |
| 1 | message or data is missing | PROCESSING_ERROR | Missing inner message or data … |
| 2 | empty UblDocument | VALIDATION_ERROR | UblDocument is missing or blank … |
| 3 | sender or receiver is missing | VALIDATION_ERROR | SenderParticipantId or ReceiverParticipantId is missing … |
| 4 | ownerTenantId does not match a tenant | PROCESSING_ERROR | Tenant could not be resolved for ownerTenantId=… |
| 5 | the sender does not exist, is not assigned or belongs to another tenant | AUTHORIZATION_ERROR | Participant not found: … / Authenticated tenant does not have access to participant: … |
| 6 | document type or process is missing | VALIDATION_ERROR | Document type ID is required / Process ID is required |
| 7 | tenant license | LICENSE_ERROR | No active license exists for tenant …, License for tenant … has expired … |
| 8 | XML, XSD, Schematron, business rules | VALIDATION_ERROR + ValidationErrors | Document validation failed: N error(s) |
| 9 | document parties (table below) | VALIDATION_ERROR + ValidationErrors | first mismatch |
| 10 | receiver in SML/SMP (does not exist, does not support the type, SMP unavailable) and other errors | PROCESSING_ERROR | Failed to queue document: … |
| 11 | everything is fine | MESSAGE_QUEUED and the rest of the lifecycle | — |
Party rules (the sender and receiver must match the cbc:EndpointID in the document):
| Document | Sender = | Receiver = | Mismatch codes |
|---|---|---|---|
| Invoice, credit note and other documents issued by the supplier | cac:AccountingSupplierParty | cac:AccountingCustomerParty | SENDER_SUPPLIER_MISMATCH, RECEIVER_CUSTOMER_MISMATCH |
Self-billing invoice (selfbilling in DocumentTypeId or cbc:CustomizationID) | cac:AccountingCustomerParty | cac:AccountingSupplierParty | SENDER_CUSTOMER_MISMATCH, RECEIVER_SUPPLIER_MISMATCH |
Order, OrderChange, OrderCancellation | cac:BuyerCustomerParty | cac:SellerSupplierParty | SENDER_CUSTOMER_MISMATCH, RECEIVER_SUPPLIER_MISMATCH |
For a self-billing invoice, therefore, the tenant is the customer, and the sender (the customer) must belong to the tenant. If the document is wrapped in an SBDH, the UBL parties inside the envelope are compared.
6.5 Identifiers and resending
- A rejection is final. APEX does not retry a rejected document — fix it and send it as a new message (new
syncKey, newcorrelation_id, newmessage_id). APROCESSING_ERRORmay also be temporary (e.g. SMP unavailable); resending is safe because nothing was queued. - Republish the same message (e.g. after a connection outage) with the same
message_idand the same body. - Never resend a document automatically just because no response arrived — if the first message went through, a second send to Peppol is irreversible. Handle this with a timeout and monitoring (10.7).
Chapter 7Send result — PeppolDocumentEvent
APEX sends a PeppolDocumentEvent (entityType = 32) at every significant processing step of a document that you sent through QHUB. Without processing it, you will not know whether an invoice has actually gone out to Peppol.
- The direction is exclusively APEX → QHUB → your system; events arrive in the same delivery queue as received documents (you tell them apart by
entityType == 32). - The content of
datais again a PascalCase JSON string. - No events are sent for received documents (Peppol → you).
7.1 When you receive an event
success: MESSAGE_QUEUED → QUEUE_PROCESSING_STARTED → MESSAGE_DELIVERED (→ MLS_RECEIVED) retry: MESSAGE_QUEUED → QUEUE_PROCESSING_STARTED → QUEUE_PROCESSING_FAILED → … → MESSAGE_DELIVERED failure: MESSAGE_QUEUED → … → QUEUE_PROCESSING_FAILED (4×) → QUEUE_DEAD_LETTER rejection: VALIDATION_ERROR | LICENSE_ERROR | AUTHORIZATION_ERROR | PROCESSING_ERROR (nothing was queued) later: MESSAGE_DELIVERED → MLS_RECEIVED_NEGATIVE (the receiving AP rejected the document)
The first event usually arrives within 5–15 seconds of publishing (plus the QHUB delay). AS4 sending makes 5 attempts with backoff of 30, 60, 120 and 240 s — you will usually know the final result within 8 minutes.
7.2 EventType values
Rejection at intake (the document never made it into the queue — final state):
EventType | Meaning | What to do |
|---|---|---|
VALIDATION_ERROR | Missing field, failed XSD / Schematron / business validation or a party mismatch. Details in ValidationErrors and ValidationWarnings. | Fix the document and send it as a new message |
LICENSE_ERROR | The tenant does not have a valid APEX license. | Contact ASOL / your partner |
AUTHORIZATION_ERROR | The sender does not exist in APEX, is not assigned to the tenant or belongs to another tenant (reason in Error). | Check SenderParticipantId; if needed, ask ASOL to register the participant |
PROCESSING_ERROR | Unrecognized ownerTenantId, missing data, the receiver is not in Peppol or does not support the document type, temporary SMP error (Error: Failed to queue document: …). | Check the tenant and the receiver; for a temporary error, send again |
Sending lifecycle:
EventType | Meaning | Message |
|---|---|---|
MESSAGE_QUEUED | The document passed the checks and is in the queue | Document queued for async AS4 sending to <endpoint> |
QUEUE_PROCESSING_STARTED | A send attempt has started (on every attempt) | Worker … started processing (attempt n) |
QUEUE_PROCESSING_FAILED | The attempt failed, another one is scheduled — intermediate state | Attempt n/5 failed, retry in Ns: <cause> |
MESSAGE_DELIVERED | Delivered to the receiver's access point (AS4 receipt) | Message delivered successfully |
QUEUE_DEAD_LETTER | Permanent failure — attempts exhausted or a permanent error (e.g. the receiver's certificate was not issued by the OpenPeppol CA); may also arrive without a preceding QUEUE_PROCESSING_FAILED | All 5 retry attempts exhausted: … / Not retried, no later attempt can succeed: … |
MLS_RECEIVED | The receiving access point confirmed processing (Peppol MLS AP/AB) | MLS AP received from … |
MLS_RECEIVED_NEGATIVE | The receiving access point rejected the document (MLS RE) — even after MESSAGE_DELIVERED | MLS RE received from …: <reason> |
Peppol MLS becomes mandatory in the network only from 28 Feb 2027 (receiving) and 31 Mar 2027 (sending) — until then, many access points will not send
MLS_RECEIVED*. Be prepared for unknownEventTypevalues: log them and acknowledge the message.
7.3 How to pair an event with your document
| Event field | You compare it with | Reliability |
|---|---|---|
PeppolDocumentKey.SyncKey | the syncKey you sent in the SynchronizationMessage | recommended — QHUB passes it through unchanged |
PeppolDocumentMessageCorrelationId | the correlation ID of the delivery received by APEX | supplementary — whether it matches your AMQP correlation_id depends on QHUB |
PeppolDocumentKey.BusinessKey | the As4MessageId you sent | empty when sending — do not use |
If you sent the document with a suffixRoutingKey, the envelope of every event carries it back.
7.4 Event example
Content of message in the delivered envelope (the routingKey, deliverySystem and transactionId fields are filled in by QHUB):
{
"transactionId": 4720,
"eventType": 1,
"entityType": 32,
"routingKey": "MYERP.c0ffee00-1111-2222-3333-444455556666",
"ownerTenantId": "c0ffee00-1111-2222-3333-444455556666",
"ownerSystem": "APEX",
"deliverySystem": "MYERP",
"deliveryTenantId": "c0ffee00-1111-2222-3333-444455556666",
"syncKey": "2f6d0a1e-4b3c-4d5e-8f70-a1b2c3d4e5f6",
"schemaVersion": "1.0.0",
"environment": "…",
"domainSyncVersion": 1,
"occurredAt": "2026-10-09T08:15:36Z",
"data": "{\"EventId\":\"f47ac10b-58cc-4372-a567-0e02b2c3d479\",\"EventType\":\"VALIDATION_ERROR\", … }",
"ignoredProperties": null,
"suffixRoutingKey": "SN-001"
}Deserialized content of data:
{
"EventId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"PeppolDocumentMessageCorrelationId": "3b2f1c0a-9d8e-4f7a-b6c5-1a2b3c4d5e6f",
"EventType": "VALIDATION_ERROR",
"Message": "Document send rejected — document validation failed",
"Error": "Document validation failed: 1 error(s)",
"ValidationErrors": "[{\"code\":\"PEPPOL-EN16931-R003\",\"message\":\"A buyer reference or purchase order reference MUST be provided.\",\"location\":\"/Invoice\"}]",
"ValidationWarnings": null,
"Timestamp": "2026-10-09T10:15:31.123456789+02:00",
"PeppolDocumentKey": {
"BusinessKey": null,
"SyncKey": "9a1d2c3e-6b7f-4c8d-9e0a-1b2c3d4e5f60"
}
}
ValidationErrorsandValidationWarningsare JSON strings — deserialize them separately. The items have the fieldscode,message,location(camelCase; parse case-insensitively). An empty list isnull. For a party mismatch,codecontains e.g.SENDER_SUPPLIER_MISMATCHandlocationthe XPath of the party.
7.5 Document status on your side
- Final states:
MESSAGE_DELIVERED(success, which a laterMLS_RECEIVED_NEGATIVEcan still override),QUEUE_DEAD_LETTER,MLS_RECEIVED_NEGATIVEand the four*_ERRORrejections. - Event order is not guaranteed — they are published by several APEX instances and QHUB processes them in parallel;
QUEUE_PROCESSING_STARTEDmay arrive afterMESSAGE_DELIVERED. Order them byTimestampand never move from a final state back to an intermediate one. - Deduplicate by
EventId.
7.6 Send an ACK for events too
PeppolDocumentEvent is a regular synchronization message — after processing it, send an ACK just as for a document (5.5).
Chapter 8Message structures
8.1 Overview — what goes where and in what format
| Direction | Exchange | Format | content-type |
|---|---|---|---|
| QHUB → you (delivery of a document or event) | your clouderp-delivery-queue.{RK} | MassTransit envelope | application/vnd.masstransit+json |
| you → QHUB (document to be sent) | clouderp-sync-queue | bare SynchronizationMessage | application/json |
| you → QHUB (ACK) | clouderp-sync-response-queue | MassTransit envelope | application/vnd.masstransit+json |
The asymmetry is the actual behavior of QHUB: the sync consumer uses a raw JSON deserializer, the response consumer does not. For both sending and ACKs, add the MT-MessageType header with the corresponding urn:message:….
8.2 MassTransit envelope
All fields are camelCase. For the ACK, the fields in bold are the ones that matter to you.
| Field | Type | Description |
|---|---|---|
messageId | string (GUID) | Message identifier; the same when the same message is retried |
correlationId | string (GUID) | Correlation ID; in the ACK, copy it from the delivery |
requestId, conversationId, initiatorId | string | Not used |
sourceAddress, destinationAddress, responseAddress, faultAddress | string | Informational |
messageType | string[] | ["urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage"] or …:SynchronizationResponseMessage |
message | object | SynchronizationMessage or SynchronizationResponseMessage |
expirationTime | string | Not used |
sentTime | string | ISO 8601 UTC |
headers, host | object | Optional / filled in by MassTransit |
8.3 SynchronizationMessage
Used in both directions; field names are camelCase.
| Field | Type | When sending (you) | On delivery (from APEX) |
|---|---|---|---|
transactionId | long | 0 | QHUB transaction ID — copy it into the ACK |
eventType | int or string | always 1 | 1 |
entityType | int or string | 30 | 30 document, 32 event |
routingKey | string | null | your routing key (filled in by QHUB) |
ownerTenantId | string (UUID) | customer's IAM tenant | customer's IAM tenant |
ownerSystem | string | your SystemCode | source system (APEX) — do not rely on its exact form |
deliverySystem | string | null | your system (filled in by QHUB) |
deliveryTenantId | string (UUID) | tenant or null | customer's IAM tenant |
syncKey | string | a new UUID for each document | document: AS4 MessageId; event: a new UUID |
schemaVersion | string | "1.0.0" | "1.0.0" |
environment | string | as agreed during onboarding | APEX environment label |
domainSyncVersion | int | 1 | 1 or a copied value |
occurredAt | string (ISO 8601) | time of creation on your side | time of publishing |
data | string (JSON) | PeppolDocument in PascalCase | PeppolDocument or PeppolDocumentEvent in PascalCase |
ignoredProperties | string[] / null | null | properties the target should ignore (filled in by QHUB) |
suffixRoutingKey | string / null | optional site label | for an event, copied from your document, otherwise null |
8.4 SynchronizationResponseMessage (ACK)
| Field | Type | Description |
|---|---|---|
transactionId | long | Copied from the delivered SynchronizationMessage |
result.success | boolean | true = processed successfully |
result.errorCode | string / null | Your error code when success=false |
result.errorParams | string[] / null | Error code parameters |
Chapter 9PeppolDocument and PeppolDocumentEvent entities
Both entities are transferred as a JSON string in the data field and both use PascalCase.
9.1 PeppolDocument (entityType = 30, schema 1.0.0)
| Field | Type | Required | Business key | Description |
|---|---|---|---|---|
SenderParticipantId | string | yes | no | Sender's Peppol ID (canonical form for received documents) |
ReceiverParticipantId | string | yes | no | Receiver's Peppol ID |
DocumentTypeId | string | yes | no | Peppol document type (with the busdox-docid-qns:: prefix for received documents) |
ProcessId | string | yes | no | Peppol process |
UblDocument | string | yes | no | XML text; for received documents the entire StandardBusinessDocument, when sending bare UBL or SBDH |
As4MessageId | string | no | yes | AS4 MessageId of the received document; empty when sending |
ReceivedAt | DateTime | no | no | Time of receipt in APEX; empty when sending |
Example — received document:
{
"SenderParticipantId": "iso6523-actorid-upis::0245:2024000002",
"ReceiverParticipantId": "iso6523-actorid-upis::0245:2024000001",
"DocumentTypeId": "busdox-docid-qns::urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1",
"ProcessId": "urn:fdc:peppol.eu:2017:poacc:billing:01:1.0",
"UblDocument": "<StandardBusinessDocument xmlns=\"http://www.unece.org/cefact/namespaces/StandardBusinessDocumentHeader\"><StandardBusinessDocumentHeader>…</StandardBusinessDocumentHeader><Invoice xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:Invoice-2\">…</Invoice></StandardBusinessDocument>",
"As4MessageId": "abc123@ap.sender.example",
"ReceivedAt": "2026-10-09T08:15:29.871Z"
}9.2 PeppolDocumentEvent (entityType = 32, schema 1.0.0)
Sent exclusively by APEX (chapter 7).
| Field | Type | Always filled in | Description |
|---|---|---|---|
EventId | string (UUID) | yes | Unique event ID (business key) — deduplicate by it |
PeppolDocumentMessageCorrelationId | string | yes | Correlation ID of the delivery of your document to APEX |
EventType | string | yes | Values in 7.2 |
Message | string | usually | Human-readable description |
Error | string / null | only on rejection | Technical detail |
ValidationErrors | string (JSON) / null | for VALIDATION_ERROR from validation and the party check | JSON array of {code, message, location} |
ValidationWarnings | string (JSON) / null | as above | Same format |
Timestamp | DateTime | yes | Time the event was created in APEX (ISO 8601 with offset) |
PeppolDocumentKey | object | yes | { "BusinessKey": …, "SyncKey": … } — SyncKey is the syncKey of your document; BusinessKey is the As4MessageId you sent (usually null) |
9.3 Entity versions
Both Version in the catalog and schemaVersion in messages are "1.0.0". When the schema changes, ASOL will release a new version and announce it.
9.4 Peppol participant ID
| Country / type | Scheme (ICD) | Example |
|---|---|---|
| Slovakia — DIČ (Slovak tax ID, recommended) | 0245 | 0245:2024000001 |
| Slovakia — IČ DPH (Slovak VAT ID) | 9950 | 9950:SK2024000001 |
| Czechia — DIČ (VAT) | 9929 | 9929:CZ12345678 |
| GLN | 0088 | 0088:1234567890123 |
The canonical form is iso6523-actorid-upis:: + the short form. Verify in the SMP which scheme the receiver has actually registered (e.g. via the lookup in the APEX API).
Chapter 10Errors, timeouts and retries
10.1 Two channels — do not confuse them
| Channel | What it carries | When it arrives |
|---|---|---|
SynchronizationResponseMessage (ACK) | technical acceptance of the message | on successful acceptance and on a technical failure |
PeppolDocumentEvent (32) | business outcome of the document | on rejection and throughout the whole sending process |
Business errors (validation, license, sender, receiver) are reported exclusively through events. If you wait for an ACK with success=false, you will wait in vain.
10.2 Registration errors (QHUB)
| Code | Cause | Resolution |
|---|---|---|
RegCodeNotFound | Invalid key (or the key is shared by several registrations) | Request a new key |
RegCodeExpired | The key has expired | Request a new key |
SystemMismatch | participantSystem does not match the registration | Check the SystemCode |
TenantMismatch | participantTenantId does not match the registration | Check the IAM tenant UUID |
HubInternalError | Internal QHUB error | Contact support |
10.3 Synchronization errors (QHUB)
If QHUB does not process your message, it marks the transaction as Failed or Skipped. The sender is not notified — that is why you need timeouts (10.7).
| Code | Cause |
|---|---|
EventTypeMissing / EventTypeWrong | Invalid eventType |
EntityDataMissing / EntityDataInvalid | data is missing or cannot be deserialized into the entity |
TenantIdMissing | ownerTenantId is missing |
SchemaVersionMissing | schemaVersion is missing |
DomainSyncVersionWrong | domainSyncVersion < 1 |
DeliverySystemWrong | No registered target exists for the message (skipped) |
DuplicateVersion / StaleVersion | A message with the same syncKey and version has already been processed |
10.4 Error codes in ACKs from APEX
APEX sends success=false only for technical problems (and never if transactionId is 0):
errorCode | When |
|---|---|
UnsupportedEntityType | An entityType other than 30 (including 32 sent to APEX) |
ProcessingFailed | Processing failed three times due to a technical error (e.g. unreadable data) |
DeserializationFailed | The body could not be deserialized |
10.5 Codes in ValidationErrors
- Schematron rule codes (
BR-…,BR-CO-…,PEPPOL-EN16931-R…, …) and XSD messages. - APEX codes:
XML_001(unreadable XML),SCHEMA_001,SCHEMATRON_001(no rules exist for the document type),SCHEMATRON_002,BUSINESS_*and party mismatch codes (6.4). - Temporary validator errors —
VALIDATION_IO,VALIDATION_ERROR,SCHEMA_ERROR,SCHEMATRON_ERROR,SCHEMATRON_000,BUSINESS_ERROR: the document is not necessarily invalid, send it again later.
10.6 Your error codes (in the ACK)
In result.errorCode you can use any string (in English, without spaces), e.g. ImportFailed, DuplicateDocument, ValidationFailed, UnsupportedDocumentType, UnexpectedError. errorParams = the code's parameters only.
10.7 When nothing arrives at all
| Situation | Why no response arrived |
|---|---|
| APEX treated the message as a duplicate | Same correlation_id, transactionId or As4MessageId — APEX silently discards the message |
data could not be processed and transactionId is 0 | A failure ACK has no transaction to be matched to; no event is created |
Empty body or an envelope without message | The message is only logged |
| Publishing to a non-existent exchange | E.g. dotted names — the broker returns 404 NOT_FOUND |
| QHUB skipped the message | Missing registration, duplicate version (10.3) |
| APEX did not publish the event | A loss of connection to QHUB lasting longer than 5 attempts (approx. 7.5 min) — the event is lost |
Recommendation: timestamp every document you send. If no event arrives within 15 minutes or no final event within 60 minutes, escalate (alert, support) — do not resend it automatically, as this risks a duplicate send to Peppol. For receiving, we recommend being able to verify the status another way as well (e.g. the inbox in the APEX API), if you have access to the API.
10.8 APEX retry policies
| What | Attempts | Backoff |
|---|---|---|
| Processing a delivered message (APEX picks it up every ~3 s) | 3, then a failure ACK ProcessingFailed | every cycle |
| Publishing ACKs from APEX | unlimited | 30 s → 60 s → 120 s → 240 s → max 300 s |
| Publishing documents and events from APEX to QHUB | 5, then the message is lost | 30 s → 60 s → 120 s → 240 s |
| AS4 sending to Peppol | 5, then QUEUE_DEAD_LETTER | 30 s → 60 s → 120 s → 240 s |
10.9 Dead-letter queue
Your delivery queue has the argument x-dead-letter-exchange: clouderp.dlq. Messages that you reject (basic.nack/reject with requeue=false) or for which the consumer fails without requeue are moved by RabbitMQ to this exchange.
clouderp.dlqis declared neither by APEX nor by QHUB — verify with ASOL that it exists and has a queue bound to it, otherwise dead-lettered messages are silently lost.- QHUB moves nothing to the DLQ and notifies no one — monitor the DLQ yourself (MassTransit additionally creates its own
…_errorqueue).
Chapter 11Implementation examples
The examples are trimmed to the essentials; add logging, transactions and persistence to suit your system. Read credentials from the environment or a vault, never put them in the code. Shared constants:
ROUTING_KEY = SYSTEM_CODE + "." + TENANT_ID EXCHANGE_DELIVERY = "clouderp-delivery-queue" (direct, exists) EXCHANGE_SYNC = "clouderp-sync-queue" (fanout, exists) EXCHANGE_SYNC_RESPONSE = "clouderp-sync-response-queue" (fanout, exists) DELIVERY = "clouderp-delivery-queue." + ROUTING_KEY (your fanout exchange and queue) MT_SYNC = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage" MT_RESPONSE = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage" ENTITY_PEPPOL_DOCUMENT = 30, ENTITY_PEPPOL_DOCUMENT_EVENT = 32
11.1 Java (Spring AMQP)
Configuration — connection and your own topology
@Configuration @EnableRabbit public class QHubConfig { static final String EXCHANGE_DELIVERY = "clouderp-delivery-queue"; // direct, exists @Value("${qhub.routing-key}") String routingKey; // MYERP.{TenantId} @Value("${qhub.url}") String url; // amqps://messaging.qasida.sk:5671 @Value("${qhub.username}") String username; @Value("${qhub.password}") String password; @Value("${qhub.ca-cert-path}") String caCertPath; // broker CA (PEM) String deliveryName() { return EXCHANGE_DELIVERY + "." + routingKey; } @Bean CachingConnectionFactory qhubConnectionFactory() throws Exception { CachingConnectionFactory cf = new CachingConnectionFactory(); cf.setUri(url); cf.setUsername(username); cf.setPassword(password); // SSLContext with a truststore from the broker CA (with mTLS, also with the client RSA key) cf.getRabbitConnectionFactory().useSslProtocol(sslContextFromPem(caCertPath)); return cf; } @Bean RabbitAdmin qhubAdmin(CachingConnectionFactory cf) { return new RabbitAdmin(cf); } // Only your own objects are declared. Do NOT define the central exchanges as @Bean — // RabbitAdmin would declare them and fail with ACCESS_REFUSED. @Bean FanoutExchange myDeliveryExchange() { return new FanoutExchange(deliveryName(), true, false); } @Bean Queue myDeliveryQueue() { return QueueBuilder.durable(deliveryName()) .withArgument("x-dead-letter-exchange", "clouderp.dlq") .build(); } @Bean Binding queueToMyExchange() { return BindingBuilder.bind(myDeliveryQueue()).to(myDeliveryExchange()); } /** Exchange-to-exchange binding: without it nothing ever reaches the queue. */ @Bean Binding myExchangeToCentral() { return new Binding(deliveryName(), Binding.DestinationType.EXCHANGE, EXCHANGE_DELIVERY, routingKey, null); } @Bean SimpleRabbitListenerContainerFactory qhubListenerFactory(CachingConnectionFactory cf) { SimpleRabbitListenerContainerFactory f = new SimpleRabbitListenerContainerFactory(); f.setConnectionFactory(cf); f.setPrefetchCount(10); f.setAcknowledgeMode(AcknowledgeMode.AUTO); f.setDefaultRequeueRejected(false); // exception → DLX, not an endless requeue // no MessageConverter: the listener gets the raw bytes of the MassTransit envelope return f; } @Bean RabbitTemplate qhubTemplate(CachingConnectionFactory cf) { return new RabbitTemplate(cf); } }
Receiving — persist-then-process
@Component @RequiredArgsConstructor public class QHubDeliveryListener { private final ObjectMapper mapper; // FAIL_ON_UNKNOWN_PROPERTIES = false private final InboxRepository inbox; // your table with unique indexes // The listener only stores the raw message; QHubInboxProcessor does the processing. @RabbitListener(queues = "#{@myDeliveryQueue.name}", containerFactory = "qhubListenerFactory") public void onDelivery(Message amqp) throws IOException { byte[] body = amqp.getBody(); if (body.length == 0) { return; } JsonNode envelope = mapper.readTree(body); if (envelope.path("messageType").toString().contains("SynchronizationResponseMessage") || !envelope.hasNonNull("message")) { return; // ACK envelope or empty message: do not store, do not reply } inbox.saveIfNew( // does nothing on a duplicate (transactionId / correlationId) envelope.path("message").path("transactionId").asLong(), envelope.path("correlationId").asText(null), new String(body, StandardCharsets.UTF_8)); } } @Slf4j @Component @RequiredArgsConstructor public class QHubInboxProcessor { private final ObjectMapper mapper; private final InboxRepository inbox; private final QHubAckSender ack; @Scheduled(fixedDelay = 3000) public void process() throws IOException { for (InboxRow row : inbox.findPending(50)) { JsonNode msg = mapper.readTree(row.rawJson()).path("message"); String entityType = msg.path("entityType").asText(); // number or string JsonNode data = mapper.readTree(msg.path("data").asText()); // 2nd deserialization, PascalCase try { if (entityType.equals("30") || entityType.equals("PeppolDocument")) { importDocument(data); // UblDocument = StandardBusinessDocument, IDs in canonical form } else if (entityType.equals("32") || entityType.equals("PeppolDocumentEvent")) { updateSentDocument(data.path("PeppolDocumentKey").path("SyncKey").asText(), data.path("EventType").asText(), data); } else { log.warn("Unknown entityType {}", entityType); } ack.send(row.correlationId(), row.transactionId(), true, null, null); } catch (Exception e) { ack.send(row.correlationId(), row.transactionId(), false, "ImportFailed", List.of(String.valueOf(row.transactionId()))); } inbox.markProcessed(row.id()); } } }
Response ACK
@Component @RequiredArgsConstructor public class QHubAckSender { private static final String MT_RESPONSE = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage"; private final RabbitTemplate qhubTemplate; private final ObjectMapper mapper; public void send(String correlationId, long transactionId, boolean success, String errorCode, List<String> errorParams) throws IOException { if (transactionId <= 0) { return; // QHUB would have no transaction to match the ACK to } // stable messageId: the same when the same ACK is retried String messageId = UUID.nameUUIDFromBytes( ("ack:" + correlationId + ":" + transactionId).getBytes(StandardCharsets.UTF_8)).toString(); Map<String, Object> result = new LinkedHashMap<>(); result.put("success", success); result.put("errorCode", errorCode); result.put("errorParams", errorParams); Map<String, Object> envelope = new LinkedHashMap<>(); envelope.put("messageId", messageId); envelope.put("correlationId", correlationId); envelope.put("messageType", List.of(MT_RESPONSE)); envelope.put("sentTime", Instant.now().toString()); envelope.put("message", Map.of("transactionId", transactionId, "result", result)); MessageProperties props = new MessageProperties(); props.setContentType("application/vnd.masstransit+json"); // REQUIRED props.setHeader("MT-MessageType", MT_RESPONSE); props.setMessageId(messageId); props.setCorrelationId(correlationId); props.setDeliveryMode(MessageDeliveryMode.PERSISTENT); // if publishing fails, store the ACK and retry until it succeeds qhubTemplate.send("clouderp-sync-response-queue", "", new Message(mapper.writeValueAsBytes(envelope), props)); } }
Sending a document to Peppol
public void sendToPeppol(String ublXml, String sender, String receiver, String documentTypeId, String processId) throws IOException { Map<String, Object> data = new LinkedHashMap<>(); // PascalCase data.put("SenderParticipantId", sender); data.put("ReceiverParticipantId", receiver); data.put("DocumentTypeId", documentTypeId); data.put("ProcessId", processId); data.put("UblDocument", ublXml); // XML text, not Base64 String syncKey = UUID.randomUUID().toString(); // new for each document Map<String, Object> msg = new LinkedHashMap<>(); // camelCase, no envelope msg.put("transactionId", 0); msg.put("eventType", 1); // always 1 msg.put("entityType", 30); msg.put("routingKey", null); msg.put("ownerTenantId", tenantId); // IAM tenant UUID msg.put("ownerSystem", systemCode); msg.put("deliverySystem", null); msg.put("deliveryTenantId", tenantId); msg.put("syncKey", syncKey); msg.put("schemaVersion", "1.0.0"); msg.put("environment", environment); msg.put("domainSyncVersion", 1); msg.put("occurredAt", Instant.now().toString()); msg.put("data", mapper.writeValueAsString(data)); msg.put("ignoredProperties", null); // outbox: stable message_id for republishing, unique correlation_id per document OutboxRow row = outbox.save(syncKey, UUID.randomUUID().toString(), mapper.writeValueAsBytes(msg)); MessageProperties props = new MessageProperties(); props.setContentType("application/json"); // NOT masstransit+json props.setHeader("MT-MessageType", "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage"); props.setMessageId(row.id().toString()); props.setCorrelationId(row.correlationId()); props.setDeliveryMode(MessageDeliveryMode.PERSISTENT); qhubTemplate.send("clouderp-sync-queue", "", new Message(row.body(), props)); }
SpEL:
#{@myDeliveryQueue.name}— the@character is mandatory, otherwise the application fails withEL1008E. Do not useJackson2JsonMessageConverteron the listener.
11.2 .NET (RabbitMQ.Client 7)
The example uses the official RabbitMQ.Client 7.x client (without MassTransit), so you have full control over both the topology and the envelopes. If you use MassTransit, make sure it does not declare the central exchanges and that both ACKs and outgoing messages have the format from chapter 8.
using System.Security.Authentication; using System.Security.Cryptography; using System.Text; using System.Text.Json; using System.Text.Json.Nodes; using RabbitMQ.Client; using RabbitMQ.Client.Events; const string ExchangeDelivery = "clouderp-delivery-queue"; const string ExchangeSync = "clouderp-sync-queue"; const string ExchangeSyncResponse = "clouderp-sync-response-queue"; const string MtSync = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage"; const string MtResponse = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage"; var routingKey = $"{systemCode}.{tenantId}"; var delivery = $"{ExchangeDelivery}.{routingKey}"; var uri = new Uri(config["QHub:Url"]!); // amqps://messaging.qasida.sk:5671 var factory = new ConnectionFactory { Uri = uri, UserName = config["QHub:Username"]!, Password = config["QHub:Password"]!, AutomaticRecoveryEnabled = true, Ssl = new SslOption { Enabled = true, ServerName = uri.Host, Version = SslProtocols.Tls12 | SslProtocols.Tls13, // add the broker CA to the certificate store (or verify it in CertificateValidationCallback); // with mTLS: CertPath = "client.pfx", CertPassphrase = … } }; await using var connection = await factory.CreateConnectionAsync(); await using var channel = await connection.CreateChannelAsync(); // ── Topology: your own objects only ── await channel.ExchangeDeclareAsync(delivery, ExchangeType.Fanout, durable: true, autoDelete: false); await channel.QueueDeclareAsync(delivery, durable: true, exclusive: false, autoDelete: false, arguments: new Dictionary<string, object?> { ["x-dead-letter-exchange"] = "clouderp.dlq" }); await channel.QueueBindAsync(delivery, delivery, routingKey: ""); await channel.ExchangeBindAsync(destination: delivery, source: ExchangeDelivery, routingKey: routingKey); await channel.BasicQosAsync(prefetchSize: 0, prefetchCount: 10, global: false); // ── Receiving: store and acknowledge (persist-then-process) ── var consumer = new AsyncEventingBasicConsumer(channel); consumer.ReceivedAsync += async (_, ea) => { var envelope = ea.Body.Length > 0 ? JsonNode.Parse(ea.Body.Span) : null; var types = envelope?["messageType"]?.ToJsonString() ?? ""; if (envelope?["message"] is JsonObject msg && !types.Contains("SynchronizationResponseMessage")) { var transactionId = long.Parse(msg["transactionId"]!.ToString()); var correlationId = envelope["correlationId"]?.GetValue<string>(); await inbox.SaveIfNewAsync(transactionId, correlationId, Encoding.UTF8.GetString(ea.Body.Span)); } await channel.BasicAckAsync(ea.DeliveryTag, multiple: false); }; await channel.BasicConsumeAsync(delivery, autoAck: false, consumer); // ── Processing a stored message (e.g. from a BackgroundService) ── async Task ProcessAsync(InboxRow row) { var msg = JsonNode.Parse(row.RawJson)!["message"]!; var entityType = msg["entityType"]!.ToString(); // number or string var data = JsonNode.Parse(msg["data"]!.GetValue<string>())!; // 2nd deserialization, PascalCase try { if (entityType is "30" or "PeppolDocument") await ImportDocumentAsync(data); // UblDocument = StandardBusinessDocument else if (entityType is "32" or "PeppolDocumentEvent") await UpdateSentDocumentAsync(data["PeppolDocumentKey"]!["SyncKey"]!.GetValue<string>(), data["EventType"]!.GetValue<string>(), data); await SendAckAsync(row.CorrelationId, row.TransactionId, true, null, null); } catch (Exception) { await SendAckAsync(row.CorrelationId, row.TransactionId, false, "ImportFailed", new[] { row.TransactionId.ToString() }); } } // ── Response ACK: MassTransit envelope ── async Task SendAckAsync(string? correlationId, long transactionId, bool success, string? errorCode, string[]? errorParams) { if (transactionId <= 0) return; // stable messageId when the same ACK is retried var messageId = new Guid(MD5.HashData(Encoding.UTF8.GetBytes($"ack:{correlationId}:{transactionId}"))); var body = JsonSerializer.SerializeToUtf8Bytes(new { messageId, correlationId, messageType = new[] { MtResponse }, sentTime = DateTimeOffset.UtcNow.ToString("O"), message = new { transactionId, result = new { success, errorCode, errorParams } } }); var props = new BasicProperties { ContentType = "application/vnd.masstransit+json", // REQUIRED MessageId = messageId.ToString(), CorrelationId = correlationId, DeliveryMode = DeliveryModes.Persistent, Headers = new Dictionary<string, object?> { ["MT-MessageType"] = MtResponse } }; await channel.BasicPublishAsync(ExchangeSyncResponse, "", mandatory: false, basicProperties: props, body: body); } // ── Sending a document: bare SynchronizationMessage ── async Task SendToPeppolAsync(OutboxRow row) // row: stored document with Id, CorrelationId and SyncKey { var data = JsonSerializer.Serialize(new Dictionary<string, string?> // PascalCase keys { ["SenderParticipantId"] = row.Sender, ["ReceiverParticipantId"] = row.Receiver, ["DocumentTypeId"] = row.DocumentTypeId, ["ProcessId"] = row.ProcessId, ["UblDocument"] = row.UblXml // XML text, not Base64 }); var body = JsonSerializer.SerializeToUtf8Bytes(new // camelCase, no envelope { transactionId = 0, eventType = 1, entityType = 30, routingKey = (string?)null, ownerTenantId = tenantId, ownerSystem = systemCode, deliverySystem = (string?)null, deliveryTenantId = tenantId, syncKey = row.SyncKey, // new UUID for each document schemaVersion = "1.0.0", environment, domainSyncVersion = 1, occurredAt = DateTimeOffset.UtcNow.ToString("O"), data, ignoredProperties = (string[]?)null }); var props = new BasicProperties { ContentType = "application/json", // NOT masstransit+json MessageId = row.Id.ToString(), // the same when republished CorrelationId = row.CorrelationId, // unique per document DeliveryMode = DeliveryModes.Persistent, Headers = new Dictionary<string, object?> { ["MT-MessageType"] = MtSync } }; await channel.BasicPublishAsync(ExchangeSync, "", mandatory: false, basicProperties: props, body: body); }
11.3 Python (pika)
import json, os, ssl, uuid import xml.etree.ElementTree as ET from datetime import datetime, timezone import pika SYSTEM_CODE = os.environ["QHUB_SYSTEM_CODE"] # e.g. MYERP TENANT_ID = os.environ["QHUB_TENANT_ID"] # IAM tenant UUID ROUTING_KEY = f"{SYSTEM_CODE}.{TENANT_ID}" EXCHANGE_DELIVERY = "clouderp-delivery-queue" EXCHANGE_SYNC = "clouderp-sync-queue" EXCHANGE_SYNC_RESPONSE = "clouderp-sync-response-queue" DELIVERY = f"{EXCHANGE_DELIVERY}.{ROUTING_KEY}" MT_SYNC = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationMessage" MT_RESPONSE = "urn:message:CloudERP.QHubApi.Hub.Abstractions.Messages:SynchronizationResponseMessage" UBL_INVOICE = "{urn:oasis:names:specification:ubl:schema:xsd:Invoice-2}Invoice" # ── Connection (values from Registration/Validate, kept in a vault) ── params = pika.URLParameters(os.environ["QHUB_URL"]) # amqps://user:pass@messaging.qasida.sk:5671 ctx = ssl.create_default_context(cafile=os.environ["QHUB_CA_CERT"]) # private CA of the broker # with mTLS: ctx.load_cert_chain("client_cert.pem", "client_key.pem") params.ssl_options = pika.SSLOptions(ctx, params.host) connection = pika.BlockingConnection(params) channel = connection.channel() # ── Topology: your own objects only, do not declare the central exchanges ── channel.exchange_declare(DELIVERY, exchange_type="fanout", durable=True) channel.queue_declare(DELIVERY, durable=True, arguments={"x-dead-letter-exchange": "clouderp.dlq"}) channel.queue_bind(queue=DELIVERY, exchange=DELIVERY, routing_key="") channel.exchange_bind(destination=DELIVERY, source=EXCHANGE_DELIVERY, routing_key=ROUTING_KEY) channel.basic_qos(prefetch_count=10) def short_id(value): # iso6523-actorid-upis::0245:… → 0245:…, busdox-docid-qns::urn:… → urn:… if value.startswith(("iso6523-actorid-upis::", "busdox-docid-qns::")): return value.split("::", 1)[1] return value def business_document(sbdh_xml): # UblDocument of a received document is a StandardBusinessDocument; look it up by namespace root = ET.fromstring(sbdh_xml.encode("utf-8")) return next(root.iter(UBL_INVOICE), None) def send_ack(correlation_id, transaction_id, success, error_code=None, error_params=None): if transaction_id <= 0: return message_id = str(uuid.uuid5(uuid.NAMESPACE_URL, f"ack:{correlation_id}:{transaction_id}")) # stable envelope = { "messageId": message_id, "correlationId": correlation_id, "messageType": [MT_RESPONSE], "sentTime": datetime.now(timezone.utc).isoformat(), "message": {"transactionId": transaction_id, "result": {"success": success, "errorCode": error_code, "errorParams": error_params}}, } channel.basic_publish( exchange=EXCHANGE_SYNC_RESPONSE, routing_key="", body=json.dumps(envelope).encode("utf-8"), properties=pika.BasicProperties( content_type="application/vnd.masstransit+json", # REQUIRED headers={"MT-MessageType": MT_RESPONSE}, message_id=message_id, correlation_id=correlation_id, delivery_mode=2)) def on_message(ch, method, props, body): envelope = json.loads(body) if body else {} msg = envelope.get("message") if msg is None or any("SynchronizationResponseMessage" in t for t in envelope.get("messageType", [])): ch.basic_ack(method.delivery_tag) # empty message or ACK envelope return correlation_id = envelope.get("correlationId") transaction_id = int(msg.get("transactionId") or 0) if not save_if_new(transaction_id, correlation_id, body): # your table with unique indexes ch.basic_ack(method.delivery_tag) # duplicate return try: entity_type = str(msg["entityType"]) # number or string data = json.loads(msg["data"]) # 2nd deserialization, PascalCase if entity_type in ("30", "PeppolDocument"): import_document(short_id(data["SenderParticipantId"]), business_document(data["UblDocument"])) elif entity_type in ("32", "PeppolDocumentEvent"): update_sent_document(data["PeppolDocumentKey"]["SyncKey"], data["EventType"], data) send_ack(correlation_id, transaction_id, True) except Exception: send_ack(correlation_id, transaction_id, False, "ImportFailed", [str(transaction_id)]) ch.basic_ack(method.delivery_tag) def send_to_peppol(ubl_xml, sender, receiver, document_type_id, process_id, outbox_id, correlation_id, sync_key): data = {"SenderParticipantId": sender, "ReceiverParticipantId": receiver, # PascalCase "DocumentTypeId": document_type_id, "ProcessId": process_id, "UblDocument": ubl_xml} message = { # camelCase, no envelope "transactionId": 0, "eventType": 1, "entityType": 30, "routingKey": None, "ownerTenantId": TENANT_ID, "ownerSystem": SYSTEM_CODE, "deliverySystem": None, "deliveryTenantId": TENANT_ID, "syncKey": sync_key, "schemaVersion": "1.0.0", "environment": os.environ["QHUB_ENVIRONMENT"], "domainSyncVersion": 1, "occurredAt": datetime.now(timezone.utc).isoformat(), "data": json.dumps(data), "ignoredProperties": None} channel.basic_publish( exchange=EXCHANGE_SYNC, routing_key="", body=json.dumps(message).encode("utf-8"), properties=pika.BasicProperties( content_type="application/json", # NOT masstransit+json headers={"MT-MessageType": MT_SYNC}, message_id=outbox_id, # the same when republished correlation_id=correlation_id, # unique per document delivery_mode=2)) channel.basic_consume(queue=DELIVERY, on_message_callback=on_message) channel.start_consuming()
For simplicity, the Python example processes the message directly in the callback; in production, store it first and process it asynchronously.
Chapter 12FAQ
How do I find out that I have received an invoice?
Consume the queue clouderp-delivery-queue.{SystemCode}.{TenantId}, unwrap the MassTransit envelope and look at message.entityType — 30 is a Peppol document. You will find the invoice inside the StandardBusinessDocument in the UblDocument field.
How do I find out whether my invoice has gone out to Peppol?
From the PeppolDocumentEvent (entityType = 32) on the same queue: success is MESSAGE_DELIVERED, a permanent failure is QUEUE_DEAD_LETTER or MLS_RECEIVED_NEGATIVE. The ACK will not tell you.
Why did I receive no response to a document I sent?
Most often: (a) APEX treated it as a duplicate (a reused correlation_id or a filled-in As4MessageId), (b) you published to a non-existent exchange (dotted names), (c) the registration is missing or QHUB skipped the message, (d) you have not registered entity 32. See 10.7.
Is the sent document validated?
Yes — XSD, Schematron according to the document type, business rules and the party check. On failure you get a VALIDATION_ERROR with details in ValidationErrors, not an ACK with success=false.
What if the receiver is not in the Peppol network?
APEX checks it in SML/SMP before queuing; if it does not find the receiver or the receiver does not accept the given document type, you get a PROCESSING_ERROR with the Error “Failed to queue document: …”.
Can I send an UPDATE or DELETE?
No. Always send eventType = 1. APEX does not evaluate eventType, and every message means a new, irreversible send. Handle invoice corrections according to the Peppol BIS rules (e.g. with a credit note).
How do I reject a received invoice?
Send the sender an Invoice Response (IMR) as a regular outgoing document — a negative ACK to QHUB never reaches them (5.7).
Can I send documents other than invoices?
Yes — credit notes, self-billing invoices, orders, invoice responses and other Peppol BIS documents; set the correct DocumentTypeId and ProcessId (Appendix A) and follow the party rules (6.4).
Do I have to preserve message order?
Neither QHUB nor APEX guarantees ordering; every document and every event is a separate message. Derive the document status from Timestamp and the final states.
I serve several customers. Is one queue enough?
No. Each customer has its own TenantId, registration, routing key and queue. For multiple sites of one customer, see 3.4.
Why does QHUB reject my ACK?
Almost always because of the format: the ACK must be a MassTransit envelope with content-type: application/vnd.masstransit+json and the MT-MessageType header. Most libraries set application/json — you have to override it.
What Peppol identifier does a Slovak company have?
The recommended scheme is 0245 (DIČ), e.g. 0245:2024000001; some companies are also registered under 9950 (IČ DPH). Verify in the SMP.
Appendix APeppol Document Type identifiers
| Document type | DocumentTypeId | ProcessId |
|---|---|---|
| Invoice | urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1 | urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 |
| Credit Note | urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2::CreditNote##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0::2.1 | urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 |
| Self-billing invoice | urn:oasis:names:specification:ubl:schema:xsd:Invoice-2::Invoice##urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:selfbilling:3.0::2.1 | urn:fdc:peppol.eu:2017:poacc:selfbilling:01:1.0 |
| Order | urn:oasis:names:specification:ubl:schema:xsd:Order-2::Order##urn:fdc:peppol.eu:poacc:trns:order:3::2.1 | urn:fdc:peppol.eu:poacc:bis:order_only:3 (or …:bis:ordering:3) |
| Order Response | urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2::OrderResponse##urn:fdc:peppol.eu:poacc:trns:order_response:3::2.1 | urn:fdc:peppol.eu:poacc:bis:ordering:3 |
| Invoice Response (IMR) | urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2::ApplicationResponse##urn:fdc:peppol.eu:poacc:trns:invoice_response:3::2.1 | urn:fdc:peppol.eu:poacc:bis:invoice_response:3 |
| MLR (Message Level Response) | urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2::ApplicationResponse##urn:fdc:peppol.eu:poacc:trns:mlr:3::2.1 | urn:fdc:peppol.eu:poacc:bis:mlr:3 |
APEX sends the technical Peppol MLS (
urn:peppol:edec:mls) itself — you neither send it nor receive it as a document. The identifiers change with Peppol BIS releases; verify them against the current Peppol code list before going live.
Appendix BIntegration checklist
Onboarding
-
SystemCodeand IAMTenantIdfor each customer (and a serial number for each site) - ALIS licenses for APEX and your system; the sending participant registered in APEX under the tenant
- Registration service URL and API key, broker CA certificates (intermediate and root), client certificate if applicable (mTLS)
- Network reachability of
messaging.qasida.sk:5671and theenvironmentvalue verified
Registration
- Description of both entities (30 and 32) submitted with
Version: "1.0.0"and theAuthorization: {key}header - ASOL/partner has created the registration and handed over the one-time key
-
Registration/Validatecalled, response parsed as camelCase, password stored in a vault
Topology
- Your own fanout exchange and queue
clouderp-delivery-queue.{RoutingKey}(queue withx-dead-letter-exchange: clouderp.dlq) - Binding queue → your exchange and an exchange-to-exchange binding from
clouderp-delivery-queuewith the routing key - Central exchanges are not actively declared; existence of
clouderp.dlqand DLQ monitoring verified
Receiving
- Raw bytes without a type converter, persist-then-process, prefetch ~10
- ACK envelopes are ignored; deduplication by
transactionId,correlationId,As4MessageId,EventId -
datais deserialized a second time (PascalCase); branching onentityType30 / 32 - The SBDH is unwrapped by namespace; the
iso6523-actorid-upis::andbusdox-docid-qns::prefixes are normalized; an emptyUblDocumentis an error
ACK
- MassTransit envelope,
application/vnd.masstransit+json,MT-MessageType, stablemessageId, copiedcorrelationIdandtransactionId - An ACK is also sent for events, and if publishing fails it is retried until it succeeds
Sending
- Bare
SynchronizationMessage,application/json,MT-MessageType, stablemessage_id, uniquecorrelation_id -
eventType = 1,entityType = 30, IAMownerTenantId, newsyncKey, emptyAs4MessageIdandReceivedAt - Parties match the
EndpointIDin the document (including self-billing invoices and orders);suffixRoutingKeyfor sites
Results and tests
- State machine covering all
EventTypevalues includingMLS_*; pairing byPeppolDocumentKey.SyncKey -
ValidationErrorsare shown to the user; temporary validator errors are handled by resending - Timeouts and alerts (15 / 60 min), no automatic resending
- Tested: receiving, sending,
VALIDATION_ERROR,AUTHORIZATION_ERROR(foreign sender),PROCESSING_ERROR(unknown receiver), self-billing invoice, site with a suffix
Appendix CContacts and support
| Request type | Contact |
|---|---|
Onboarding (SystemCode, TenantId, API key, registration and registration key) | ASOL integration team or your partner |
| QHUB technical support (RabbitMQ, access, certificates, DLQ) | ASOL DevOps / Cloud team |
| Peppol technical support (SMP registration, validation, delivery) | ASOL Peppol team |
| Bug report | Customer Portal |
Appendix DWhat to verify during onboarding
These values depend on the environment or on the QHUB configuration, and you get them from ASOL:
- The QHUB registration service URL, the API key for the entity catalog, and whether
Registration/Validaterequires theAuthorizationheader. - Network reachability of the broker
messaging.qasida.sk:5671from your environment (firewall), the virtual host, and whether the environment requires mTLS. - The
environmentvalue and the exact form ofownerSystem(bareSystemCodeor the full routing key). - Existence of the
clouderp.dlqexchange with a bound queue, and permission to write to it. - Maximum message size on the broker (documents with large attachments).
- For multiple sites: routing by
suffixRoutingKeyand the name of the site queue. - Validity period and one-time nature of the registration key.