Lerian STA
The Mensageria consumes the topic
lerian.streaming.br-sta, which Lerian STA produces. It registers six event types:
br_sta_transfers.acceptedbr_sta_transfers.rejectedbr_sta_transfers.inconsistentbr_sta_transfers.canceledbr_sta_transfers.download_finishedbr_sta_transfers.download_not_authorized
source_product matches its STA_SOURCE_PRODUCT setting. It ignores the events of other products. The direction field of each event selects the pipeline. One direction is a file that Lerian STA downloaded for the Mensageria. The other is the outcome of a response file that the Mensageria submitted.
The database also refuses a second remittance file with the same SHA-256 digest for the same institution.
With STA_TRANSFERS_ENABLED on, the Mensageria submits each response file to Lerian STA. How Lerian SISBAJUD works describes the submission.
Dead-lettered events
A Lerian STA event that the Mensageria refuses goes to the topiclerian.streaming.br-sisbajud.dlq. The record carries a reason token, for example institution_unresolved or sha256_mismatch.
POST /v1/institutions/{institutionId}/sta-dlq/{eventId}/acknowledge records what an operator did with one dead-lettered event: replayed, recorded, or escalated. It writes an audit record. It does not remove the event, and the topic keeps the event for its retention period. To replay an event, move the consumer group back to the source offset that the record headers name.
Streaming Hub and the executor
The Mensageria publishes the execution notices and the probes on
lerian.streaming.br-sisbajud. The Streaming Hub delivers them to the executor by webhook.
An operator creates one Streaming Hub subscription for the executor. The subscription lists exactly two event types: judicial_order.execution_requested and sisbajud_probe.requested. The Streaming Hub signs each delivery with the secret of the subscription. The executor verifies that signature. It runs each delivery under its own tenant and does not use the tenant header of the delivery.
Do not rely on the arrival order of execution notices. The Mensageria keeps the order of releases for a subject in its database.
Execution API
The executor reads orders and reports results through the execution API. These operations are not in the Mensageria API reference.
The execution API has its own listener at
SISBAJUD_EXECUTION_ADDRESS. The default is :4032. The main API at SERVER_ADDRESS does not serve these paths. The execution listener accepts TLS 1.2 or later and has no plain HTTP mode. SISBAJUD_EXECUTION_TLS_CERT_FILE and SISBAJUD_EXECUTION_TLS_KEY_FILE hold the server certificate and key.
SISBAJUD_EXECUTION_MTLS_ENABLED turns on mutual TLS. Then the listener requires a client certificate that SISBAJUD_EXECUTION_CLIENT_CA_FILE verifies. The executor has its own switch, MENSAGERIA_MTLS_ENABLED. Set both switches to the same value. With mutual TLS on the Mensageria and off on the executor, the TLS handshake fails.
The executor authenticates with an M2M bearer token. Its client holds the role br-sisbajud-executor-role, which grants the three permissions in the table. The Mensageria takes the identity and the role from the token only. The client certificate does not change authorization.
Canary probe
EveryEXECUTION_CANARY_INTERVAL_SEC seconds, the Mensageria publishes one sisbajud_probe.requested event for each enabled institution. The default is 300. The executor answers with POST /v1/sisbajud/execution/probes/{probeId}. Enable an institution on the Mensageria when an executor serves that institution.
Events
The Mensageria publishes three event types on the topic
lerian.streaming.br-sisbajud.
- The
operationof an execution notice isREQUISICAO_INFORMACAO,BLOQUEIO, orDESBLOQUEIO. - The Mensageria publishes
kek.rotatedwhen an operator rotates an institution’s KEK with HashiCorp Vault as the key provider. - The
ce-typeheader isstudio.lerian.br-sisbajud.<resource>.<event>, for examplestudio.lerian.br-sisbajud.kek.rotated. - The
ce-schemaversionheader carries the schema version. - The dead-letter topic of
kek.rotatedislerian.streaming.br-sisbajud.dlq.
Topics
WithSTREAMING_TOPIC_AUTO_PROVISION at its default, true, the Mensageria creates lerian.streaming.br-sisbajud and lerian.streaming.br-sisbajud.dlq at startup. Its broker identity needs permission to create these topics. If you create the topics before you deploy, set STREAMING_TOPIC_AUTO_PROVISION to false.
