Class Inbox

java.lang.Object
com.onec.kafka.Inbox

public class Inbox extends Object
Idempotency ledger for inbound CloudEvents. Kafka delivers at-least-once, so the same event id may arrive more than once; the inbox records each id and lets the consumer skip duplicates.

The CloudEvent id is stored as text rather than UUID so events from external, non-onec producers (whose ids may be arbitrary strings) interoperate without translation.

  • Constructor Details

    • Inbox

      public Inbox(org.jdbi.v3.core.Jdbi jdbi)
  • Method Details

    • initSchema

      public void initSchema()
    • markReceivedIfNew

      public boolean markReceivedIfNew(String id, String eventType, String source)
      Records the event as RECEIVED if its id has not been seen before.
      Returns:
      true if this is the first sighting (caller should process it), false if it is a duplicate (caller should skip).
    • markProcessed

      public void markProcessed(String id)
    • markFailed

      public void markFailed(String id, String error)