Order flow
Order intake
Lerian STA events are the only way an order file enters the Mensageria. The Mensageria consumes the topic
lerian.streaming.br-sta in the consumer group br-sisbajud-sta-intake-v1. It keeps the events whose source product matches its STA_SOURCE_PRODUCT setting and ignores the others.
Before the Mensageria downloads a file, it compares the file size with STA_MAX_INBOUND_SIZE_BYTES. After the download, it compares the SHA-256 digest of the file with the digest in the event. A mismatch rejects the file.
The Mensageria reads the environment, production or homologation, from the file header.
The block remittance file is fixed-width text in ISO-8859-1. The 2026 layout has 684-character records. The CNJ v1.11 layout has 410-character records.
SISBAJUD_REMITTANCE_LAYOUTS lists the layouts that the Mensageria accepts. The default is v111,v2026. The Mensageria rejects a file in a layout that is not on the list.
Order record
The Mensageria turns each file into judicial orders. It records these order types:
BLOQUEIO(block)DESBLOQUEIO(unblock)REQUISICAO_INFORMACAO(information request)REITERACAO(reiteration)
TRANSFERENCIA (transfer) and CANCELAMENTO (cancellation) orders, and some DESBLOQUEIO orders.
An order moves through the statuses PENDING, PROCESSING, MONITORING, COMPLETED, and FAILED.
The Mensageria encrypts sensitive fields with a data key for each operation. The institution’s key-encryption key wraps that data key. The key manager is HashiCorp Vault Transit or AWS KMS.
Permanent block
In the 2026 layout, each block record carries a permanent-block indicator. The valueP or D marks a permanent block, and D also carries a deadline date. Any other value marks a block that is not permanent. In the CNJ v1.11 layout, these positions are a spacer, and the Mensageria ignores them.
Parked orders
The Mensageria does not execute aTRANSFERENCIA or a CANCELAMENTO order. It parks the order for a manual procedure. The executor gets no execution notice for a parked order, and no response file answers it.
For a parked CANCELAMENTO, the block can stay on Midaz until you release it manually.
The Mensageria also parks a DESBLOQUEIO order when it has no usable record of the original BLOQUEIO, for example a block from an earlier system. The money can stay blocked until you release it manually.
The Mensageria logs each parked order with its ID. The sisbajud_parked_open_total metric counts the open parked orders. When the response deadline of a parked order passes, the Mensageria logs an error with the order ID.
Release to the executor
The Mensageria releases the orders of a subject one at a time. A subject is the CPF or CNPJ that an order targets, inside one institution. The next order of a subject is released after the previous order is settled. A result from the executor can settle it. The Mensageria writes the release and its execution notice in the same database transaction. The database, not the broker, keeps the order of releases for a subject.
Execution on Midaz
For each execution notice, the executor:
- Gets the order from the Mensageria.
- Checks that the order’s institution is registered on this executor as its own. For any other institution, it writes nothing.
- Writes the block or unblock on Midaz. Each write carries an idempotency key built from the order ID and the order revision.
- Reports the result to the Mensageria.
Response files
The Mensageria generates two kinds of response file:
- A block response file:
5302in production,5312in homologation. - An information response file:
5309in production,5319in homologation. It answers information requests.
RETURN_FILE_GENERATION_ENABLED turns on the block responses, and INFORMATION_RETURN_FILE_GENERATION_ENABLED turns on the information responses. A response file takes the environment, production or homologation, of the remittance that its orders answer. RETURN_FILE_ENVIRONMENT applies only when no remittance backs the orders. The default is HOMOLOGATION. SISBAJUD_RESPONSE_LAYOUT set to auto, the default, answers in the layout of the original remittance. The values v111 and v2026 force one layout.
With STA_TRANSFERS_ENABLED on, the Mensageria submits each response file. It writes the file to the shared bucket, then calls POST /v1/transfers on Lerian STA.
The file-exchange transport itself is the client-owned integration that Lerian STA describes. Lerian SISBAJUD is one of its downstream source products.

