Skip to main content

Queues & routing

The hub runs on a dual messaging fabric: IBM MQ (via the Spring Cloud Stream sjms2 binder) carries the mission-critical SWIFT/enterprise queues, while Apache Kafka carries inter-service events, fallbacks, idempotency, and the dead-letter stream. One cross-border channel uses AWS SQS. Destination names are literal strings in each module's application-bindings.yml; the IBM MQ queue manager must have a matching DEFINE QLOCAL for each (see docker/mq/20-config.mqsc).

Destination types

TypeBinderCarries
IBM MQ queuesjms2SWIFT in/out, CBS/TMS/ERP exchange, screening (SSC), fraud, archiving, statements
Kafka topickafkaDLQ stream, per-service *.idempotent, S3-fallback notices, cross-border events, observability, STP/ISO mirrors
SQS queueaws2-sqsInbound Mastercard cross-border status webhook

Inbound channels (IBM MQ)

QueueConsumer bindingModule
SWIFT.OUT.MT.ALLINCOMINGswiftMTProcessor-in-0processor
SWIFT.OUT.ISO.ALLINCOMINGincomingISO2CBSProcessor-in-0processor
SWIFT.OUT.MT.ALLACKS / SWIFT.OUT.ISO.ALLACKSackMTProcessor-in-0 / incomingACKSISOProcessor-in-0processor
SWIFT.OUT.NON.DELIVERY.NOTICEnonDeliveryNoticeProcessor-in-0processor
SSC.INWARD.SCREENEDmtIncomingProcessor-in-0processor
SWIFT.IN.CLEARED.ISOclearedISOProcessor-in-0processor
CBS.MT.OUT / TMS.MT.OUT,TMS.MT.OUT.UAT / ERP.MT.OUT / TRACKER.MT.OUTcbsMTProcessor / tmsMTProcessor / sapMTProcessor / trackerMTProcessorprocessor
CBS.ISO.OUT / TMS.ISO.OUT.UAT / ERP.ISO.OUT / ERP.XML.OUTPDU converters (mxToISOPDUProcessor, tmsISOPDUProcessor, erpToMxPDUProcessor, sapXmlProcessor)processor
MT.DOS.PCC.QUEUE,MT.RJE.QUEUE,SAA.MOD.QUEUEofacProcessor-in-0manager

Downstream / outbound (IBM MQ)

QueuePurpose
CBS.MT.IN.CORE · CBS.MT.IN.PAYMENT · CBS.MT.IN.OTHERSCore-banking inbound by category
CBS.MT.IN.CORE.FALLBACK · CBS.MT.IN.PAYMENT.FALLBACK (Kafka)S3-fallback notices when MQ publish fails
TMS.MT.IN.UAT · TMS.ISO.IN.UATTreasury inbound
ERP.STATEMENTS.IN (prod: CBS.MT.IN.STATEMENTS)Statements to ERP/CBS
SWIFT.IN.ISO · SWIFT.IN.MT · SWIFT.IN.DOSCleared messages back to SWIFT
SWIFT.IN.ISO.CBS.STP · SWIFT.IN.ISO.TMS.STP · SWIFT.IN.MT.CBS.STP · SWIFT.IN.MT.SAP.STPStraight-through-processing lanes
FRAUD.ISO.IN.QUEUE · FRAUD.MT.IN.QUEUEFraud screening
SSC.IN.QUEUE · SSC.IN.BYPASS · SSC.DECISION.QUEUE · SSC.INWARD.SCREENED · SSC.OUT.REJECTED · SSC.INWARD.REJECTEDSanctions-screening (OFAC) pipeline
ARCHIVING.QUEUE · ARCHIVING.ISO.QUEUE · SWIFTWAREHOUSE.IN.QUEUE · SWIFTWAREHOUSE.IN.ISO.QUEUE · STATEMENTS.ISO.QUEUEArchival & warehousing
SWIFT.MT.CROSSBORDER · SWIFT.MT.CROSSBORDER.STATUSCross-border in/out

Kafka topics

TopicRole
MESSAGE.HUB.EXCEPTION.DLQCentral dead-letter stream (every module produces; afpay-message-dlq consumes)
DLQ.ALERT.QUEUEOperator alerts raised by the DLQ service
<app-name>.idempotentPer-service idempotency log (KafkaIdempotentRepository)
CBS.MT.IN.CORE.FALLBACK · CBS.MT.IN.PAYMENT.FALLBACKSFTP→S3 fallback notices
MC.PAYMENT.OUTGOING · MC.PAYMENT.FEEDBACKMastercard cross-border events
ARCHIVING.COPY.MT.TOPIC · ARCHIVING.COPY.ISO.TOPICArchive copy stream
MT199.TRACKER.MT.OUT · OPS.MANUAL.MT199.TRACKERGPI tracker MT199 status
mhub.observability.messages.{lifecycle,errors,compliance}Message observability events

SQS

QueueBindingProducer
message-hub-crossborder-webhookmcStatusWebhookProcessor-in-0 (crossborder)crossborder-webhook-lambda (Quarkus on AWS Lambda)

Routing rules

Inbound MT after screening → CBS fan-out (SSC.INWARD.SCREENEDhandleIncomingMT):

  • MT category 1 or 2CBS.MT.IN.PAYMENT (prod remaps to CBS.MT.IN.CORE)
  • MT 940 / 950ERP.STATEMENTS.IN (prod: CBS.MT.IN.STATEMENTS)
  • otherwise → CBS.MT.IN.CORE
  • always also copied to ARCHIVING.QUEUE + SWIFTWAREHOUSE.IN.QUEUE
  • types 3xx/5xx or 199/999/940/942/950also TMS.MT.IN.UAT

Outbound MT fan-in → SWIFTCBS.MT.OUT, TMS.MT.OUT(.UAT), ERP.MT.OUT, TRACKER.MT.OUT all converge on handleOutgoingMT (a route is created per CSV destination).

Inbound ISO / PDU conversion (handleMxToISOPDU): if the formatted type is pacs.008 / pacs.009 → route to FRAUD.ISO.IN.QUEUE; otherwise straight to handleClearedISO.

Cleared-ISO STP decision (SWIFT.IN.CLEARED.ISOhandleClearedISO): STP is eligible when enabled and type is pacs.008/009 and amount ≤ the currency/origin threshold. Then:

  • STP + origin TMS → SWIFT.IN.ISO.TMS.STP
  • STP + origin CBS/SAP → SWIFT.IN.ISO.CBS.STP
  • non-STP → SWIFT.IN.ISO (queue + Kafka mirror)

MT screening & STP (manager): MT 103/202FRAUD.MT.IN.QUEUE; else SWIFT.IN.CLEARED.MT. Cleared SAP-origin → SWIFT.IN.MT.SAP.STP, else SWIFT.IN.MT.CBS.STP; non-STP → SWIFT.IN.MT (+ SWIFT.IN.DOS).

ACKs / non-delivery — ACKs consumed off SWIFT.OUT.*.ALLACKS; non-delivery notices consumed off MQ and republished to Kafka under the same name.

SFTP fallbackCBS.MT.IN.CORE/PAYMENT are also consumed by the SFTP module; on an MQ publish failure the payload is stored in S3 and a notice is emitted to the Kafka *.FALLBACK topic.

DLQ — every route uses a Camel deadLetterChannel("seda:dlq") (3 redeliveries, 5 s delay, original message preserved). Failures land on MESSAGE.HUB.EXCEPTION.DLQafpay-message-dlq persists to DynamoDB, raises a Jira ticket, and emits DLQ.ALERT.QUEUE.

:::note Idempotency (three layers)

  1. Kafka<app-name>.idempotent log per service (key JMSMessageID-CamelMessageTimestamp).
  2. Redis — file-level dedup in the SFTP module (35-day TTL).
  3. DynamoDB — UUID + auto-versioning in tracker / archive / DLQ. :::