Skip to main content
Lerian STA is event-first at its edges. A transition to one of the six outcomes below writes the state change, an audit record, and a business record in one database transaction, through a transactional outbox. Consumers are the source-product services that own the files Lerian STA delivers.

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_ENABLED is true.
  • A signed business channel, routed as sta.{direction}.{sanitized-source-product} with an unrouted fallback, for external product consumers. It carries six terminal transfer outcomes. The payload field status names the state (Accepted, Rejected, Inconsistent, Canceled, DownloadFinished, or NotAuthorized), and outcome reads SUCCESS, FAILURE, or CANCELED.
  • The event stream, when STREAMING_ENABLED is true. It carries the same outcomes as CloudEvents of type studio.lerian.br-sta.br_sta_transfers.<event>, where <event> is accepted, rejected, inconsistent, canceled, download_finished, or download_not_authorized.
Business events carry an 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 reconciles the result into the client’s ledger. 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 performs the ledger reconciliation, for example Lerian SISBAJUD for judicial asset-order files. This keeps Lerian STA a pure transport-and-integrity layer, independent of any one file’s business meaning.

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 business events by direction and sanitized source product, with an unrouted fallback. It does not enforce that only one subscriber can receive a file.