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.
AJUD303B and AJUD304B use the same code in production and in homologation.
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)INTERRUPCAO_BLOQUEIO_PERMANENTE(stop of a permanent block, record 10)NOTIFICACAO_RECEBIMENTO_TRANSFERENCIA(notice of an incoming judicial transfer, record 08)
NOTIFICACAO_RECEBIMENTO_TRANSFERENCIA order when it records it. Plugin SISBAJUD gets no execution notice for it. A block response file answers it with the code 01 (Recebida).
The Mensageria sends an INTERRUPCAO_BLOQUEIO_PERMANENTE order to Plugin SISBAJUD after the block, in the queue of the same subject. It exists only for the institution that the court cited, and it carries no amount. No line of the block response file answers a completed interruption.
The Mensageria parks the TRANSFERENCIA (transfer) and CANCELAMENTO (cancellation) orders, and some DESBLOQUEIO orders. It also parks the clarification requests (record 09), and a record 10 that it cannot run.
An order moves through the statuses PENDING, PROCESSING, MONITORING, COMPLETED, and FAILED.
The Mensageria encrypts sensitive fields with a data key for each operation. A 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.
Permanent block captures
A permanent block keeps capturing new credits after the first answer. A capture reaches the court in this order:- The first block response with the code
29(no balance) or30(partial block) tells the court that the permanent block is active. - Plugin SISBAJUD captures new credits up to the order amount. It tells the Mensageria about each capture and about the close. A capture never changes the answer that the court already has.
- The Mensageria reports a capture only after BACEN accepted the
5302of the order, in the syntax verdict (5303) and in the semantic verdict (5304). It never reports a capture in the same consolidation as that5302. - In the response cycle, after the
5302, the Mensageria writes one AJUD302-B for each origin remittance, with one line for each captured product. It submits the file through Lerian STA. - While the AJUD302-B of a remittance waits for BACEN, the next captures of that remittance wait for it.
- A rejection in the AJUD303B leaves the file
REJECTED. Its captures wait for a reconsolidate. - In the AJUD304B, each capture is accepted or rejected. A rejected capture opens a non-conformity and shows in the orders that need attention. The money of a rejected capture stays blocked. Your institution informs the court outside the response files, except for a capture that BACEN rejected with error
04: the court already holds it, so you only justify it. - The AJUD302-B does not carry some captures. Each one becomes a rejected capture with its cause, and the Mensageria never sends it again. These captures are:
- A capture that the AJUD302-B layout cannot hold: an agency of more than 4 characters, an account of more than 10, a check digit of more than 1, a product class of more than 2, or a product code of more than 3 digits. A non-digit character in the agency, the account, the check digit, or the product code also leaves the capture out.
- A capture of an order whose block response BACEN rejected, when BACEN accepted no other response of that order.
- An interruption, a cancellation, and a transfer that ends the block stop the captures.
Before you turn the switch on in production, test a
29 and a 30 in homologation.Parked orders
The Mensageria does not execute aTRANSFERENCIA or a CANCELAMENTO order. It parks the order for a manual procedure. Plugin SISBAJUD gets no execution notice for the parked order itself, and no response file answers it.
For a parked CANCELAMENTO, the block can stay on Midaz until you release it manually.
When a parked CANCELAMENTO, or a parked TRANSFERENCIA that releases the remaining balance, ends a permanent block, the Mensageria also sends Plugin SISBAJUD the interruption of that permanent block, for the institution that holds it. New credits stop being captured. The money already blocked waits for the manual procedure. The Mensageria sends no interruption when the original block is absent or not permanent.
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 parks a clarification request (record 09) because a person must write its answer. Answer the court manually.
The Mensageria sends a record 10 to Plugin SISBAJUD as an INTERRUPCAO_BLOQUEIO_PERMANENTE order, and the captures stop. It parks a record 10 only when it cannot run it: a field it cannot read (the reason names the field), no original block, or an original block that was erased. When a field is unreadable, Plugin SISBAJUD keeps capturing for that permanent block until it is stopped. The parked reason says what to do: identify the original block and the institution the court cited (with the court, if they are unreadable). If the block ran outside Lerian SISBAJUD, stop it there. Otherwise, ask Lerian operations to stop the permanent block in Plugin SISBAJUD. New credits can stay blocked until the stop, and what was captured before it stays blocked and goes to the court in the AJUD302-B. Two records 10 of the same block for two institutions become two interruptions. A resend does not create another.
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 Plugin SISBAJUD
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 Plugin SISBAJUD 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, Plugin SISBAJUD:
- Gets the order from the Mensageria.
- Checks that the order’s institution is registered on Plugin SISBAJUD 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 three kinds of response file:
- A block response file:
5302in production,5312in homologation. - An information response file:
5309in production,5319in homologation. It answers information requests. - An AJUD302-B file (code
B302, the same in both environments). It reports the later captures of permanent blocks. The Mensageria generates it in the same cycle as the block response, withRETURN_FILE_GENERATION_ENABLED.
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, and to the AJUD302-B always. 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.

