Skip to main content
Lerian BC Correios publishes nine JSON business facts as CloudEvents 1.0 in binary content mode over Kafka. The service needs a Kafka broker in every environment: set STREAMING_BROKERS and the other broker variables. The event streaming overview describes the shared envelope.

Transport contract

The manifest lists the event catalog. It is served at the service root, not under /api/v1/correios. The route needs the Access Manager resource streaming-manifest with the action get, which the editor group holds.

Delivery

Each event has one of three delivery modes:
  • Outbox: the service writes the event to its PostgreSQL outbox in the same transaction as the change that caused it, and a relay publishes it to Kafka. If the broker is down, the relay retries for 7 days.
  • Direct, outbox fallback: the service publishes the event to Kafka. If the broker is unavailable, the service writes the event to the outbox.
  • Best effort: the service publishes the event to Kafka, with no outbox and no dead letter.
A broker that is down does not stop the service. An event can arrive more than once: deduplicate on (ce-source, ce-id) and keep consumers idempotent. Do not rely on arrival order.

Event catalog

The service does not start when STREAMING_EVENT_POLICIES turns off an event with the Outbox delivery.

Payload fields

errorClassification is BCC-2011 when the send moved to FAILED, and BCC-2010 when it moved to AMBIGUOUS. The AI events carry no insight text. Read the insight with GET /mails/{id}/ai-status.