Event channels
Lerian STA publishes on these channels:
- An audit channel carrying the Lerian STA audit trail: credential changes, transfer state changes, operator actions, and inbound file outcomes. It feeds the Lerian STA audit log and runs when
AUDIT_PUBLISHER_ENABLEDistrue. - A signed business channel, routed as
sta.{direction}.{sanitized-source-product}with anunroutedfallback, for external product consumers. It carries six terminal transfer outcomes. The payload fieldstatusnames the state (Accepted,Rejected,Inconsistent,Canceled,DownloadFinished, orNotAuthorized), andoutcomereadsSUCCESS,FAILURE, orCANCELED. It also carries the Reporter filing outcomes, routed by outcome name. - The event stream, when
STREAMING_ENABLEDistrue. It carries the same outcomes as CloudEvents of typestudio.lerian.br-sta.br_sta_transfers.<event>, where<event>isaccepted,rejected,inconsistent,canceled,download_finished, ordownload_not_authorized.
error_code only for failed and canceled outcomes, and an operator cancel leaves it empty. Inbound-success events carry the claim-check.
The claim-check
On a completed inbound download, Lerian STA emits its terminal download-finished event, routed by the file’s source product. The event carries a claim-check (
object_key, sha256, size_bytes, and file_name), but not the bytes themselves. For inbound terminal facts, document_code carries the observed BACEN code. When the persisted mnemonic and code corroborate each other, document_type carries the mnemonic. Otherwise it retains the code for compatibility. An operator cancel of an inbound transfer carries neither field.
The consuming domain product subscribes to its own key. It fetches the durable artefact by its object key and re-verifies the SHA-256. It then processes the file. Lerian STA is the transport and integrity boundary. The consuming product owns the ledger posting.
Ledger boundary
Lerian STA does not write to the client’s ledger itself. It delivers the file and the claim-check. The consuming product owns any ledger posting. For example, the Lerian SISBAJUD Mensageria reads the judicial order files, and the Lerian SISBAJUD executor runs the orders on Midaz. This keeps Lerian STA a pure transport-and-integrity layer, independent of any one file’s business meaning.
Regulatory filings from Reporter
When
REPORTER_EVENTS_CONSUMER_ENABLED is true, Lerian STA consumes the regulatory.filing_approved event from Reporter. It files the approved report at BACEN as an outbound transfer. Before it sends the report, Lerian STA compares the stored file with the artifact_sha256 of the event.
Lerian STA reports the result of a filing as a filing outcome. It publishes the outcome on the signed business channel, with the outcome name as the routing key. When STREAMING_ENABLED is true, it also publishes the outcome on the event stream.
Both outcomes carry
report_id, document_id, document_version, event_id, and source_event_id. source_event_id is the CloudEvent id of the approval, when the approval has one. A delivered outcome adds channel, protocol, and delivered_at, the time when Lerian STA observed the acceptance. A refused outcome adds refused_at and reason. The reason is checksum_mismatch, digest_missing, credential_unavailable, malformed_approval, rejected_by_regulator, inconsistent_transfer, canceled, or transfer_failed.
Integration conventions
- Commit-coupled events. A record written with a state change becomes available only after that change commits.
- Claim-check, not payload. Consumers receive a reference to the durable artefact, fetch it, and re-verify its SHA-256 before acting on it.
- At-least-once delivery. Deduplicate on the payload
event_id, which stays the same for one terminal fact. - Keyed subscription. Clients choose their broker subscriptions. STA routes signed transfer outcomes by direction and sanitized source product, with an
unroutedfallback. It does not enforce that only one subscriber can receive a file.

