Skip to main content
BACEN delivers every judicial order as a remittance file. The Mensageria receives the file through Lerian STA, records the orders, and releases them one at a time. The executor runs each order on the Midaz ledger and reports the result. The Mensageria then writes the response file and submits it to BACEN through Lerian STA.

Order flow


Lerian SISBAJUD 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)
The Mensageria parks the 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 value P 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 a TRANSFERENCIA 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:
  1. Gets the order from the Mensageria.
  2. Checks that the order’s institution is registered on this executor as its own. For any other institution, it writes nothing.
  3. Writes the block or unblock on Midaz. Each write carries an idempotency key built from the order ID and the order revision.
  4. Reports the result to the Mensageria.
For an information request, the executor reads the subject’s balances and writes nothing on the ledger. When the executor cannot finish an order alone, it hands the order to an operator as a human decision. How the Lerian SISBAJUD executor runs orders describes each operation.

Response files


The Mensageria generates two kinds of response file:
  • A block response file: 5302 in production, 5312 in homologation.
  • An information response file: 5309 in production, 5319 in homologation. It answers information requests.
A scan at a configured interval picks up finished orders that have no response yet. 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.