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 file of judicial orders 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 Plugin SISBAJUD
The Mensageria publishes the execution notices and the probes on
lerian.streaming.br-sisbajud. The Streaming Hub delivers them to Plugin SISBAJUD by webhook.
An operator creates one Streaming Hub subscription for Plugin SISBAJUD. A single-tenant Streaming Hub stores it under its own tenant (STREAMING_HUB_TENANT_ID) and attributes every event of the Mensageria to that tenant. For a multi-tenant Streaming Hub, create it under the tenant default, which every event of the Mensageria carries. 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. Plugin SISBAJUD 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
Plugin SISBAJUD reads orders and reports results through the execution API. These operations are not in the Mensageria API reference.
The result that Plugin SISBAJUD posts with
postExecutionResult also carries each later capture of a permanent block and the close of that block. These never change the answer that the court already has.
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. Plugin SISBAJUD has its own switch, MENSAGERIA_MTLS_ENABLED. Set both switches to the same value. With mutual TLS on the Mensageria and off on Plugin SISBAJUD, the TLS handshake fails.
Plugin SISBAJUD authenticates with an M2M bearer token. The Mensageria takes the identity from the token only. The client certificate does not change authorization. The execution API refuses the token of a person with 403.
Canary probe
EveryEXECUTION_CANARY_INTERVAL_SEC seconds, the Mensageria publishes one sisbajud_probe.requested event for each enabled institution. The default is 300. Enable an institution on the Mensageria when Plugin SISBAJUD 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,DESBLOQUEIO,TRANSFERENCIA, orINTERRUPCAO_BLOQUEIO_PERMANENTE. - The Mensageria publishes
kek.rotatedeach time it records a new KEK version of an institution, with either 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
ce-tenantidheader isdefault. - 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.
