SPB (Sistema de Pagamentos Brasileiros) simulator implementing Brazilian financial message protocols.
The simulator implements explicit queue separation for IBM MQ message routing:
- Purpose: Inbound financial institution requests
- Consumers: MQ worker (continuous polling)
- Publishers: Test endpoints (/api/ingest/str*), IF via external MQ
- Typical value:
QL.REQ.00000000.99999999.01 - Environment variable:
IBMMQ_QL_REQ_NAME
The MQ worker polls this queue continuously and processes:
- STR (Structured Transfer Request) messages from financial institutions
- Test/injection messages from development endpoints
- Purpose: Outbound responses and autonomous BACEN messages
- Consumers: External systems monitoring BACEN responses
- Publishers: Response handlers, SLB ingest (/api/ingest/slb*), producer
- Typical value:
QL.RSP.00000000.99999999.01 - Environment variable:
IBMMQ_QL_RSP_NAME
The response queue is where:
- Reply messages (R1, R2, R3 responses to STR requests) are published
- Autonomous SLB messages (SLB0001, SLB0002, SLB0006, SLB0007) are published
- External systems consume BACEN responses
Queue names are resolved from environment variables once at component startup, not on each message:
# Backend component initialization
IBMMQ_QL_REQ_NAME=QL.REQ.00000000.99999999.01 \
IBMMQ_QL_RSP_NAME=QL.RSP.00000000.99999999.01 \
java -jar backend.jarAll subsequent polling and sending uses the initialized values. Changing env vars after startup has no effect on running components.
If a queue doesn't exist (MQRC 2085):
- Producer: Returns
false, logs warning with queue name and timestamp. No exception thrown. - Consumer: Logs warning, returns empty message list, continues polling at interval.
- Service: Remains operational. Fix the queue and resume normal operation.
- Consumer (
infrastructure/mq/consumer.clj): Acceptsrequest-queue-nameas parameter - Producer (
infrastructure/mq/producer.clj): Acceptsqueue-nameas parameter - MQ Worker (
components/mq_worker.clj): Resolves both queue names via config.reader at startup - Config Reader (
config/reader.clj): Definesmq-request-queue-nameandmq-response-queue-namefunctions - SLB Ingest (
controllers/slb/ingest.clj): Usesmq-response-queue-namefor autonomous messages