Package com.onec.kafka
Class Inbox
java.lang.Object
com.onec.kafka.Inbox
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidmarkFailed(String id, String error) voidmarkProcessed(String id) booleanmarkReceivedIfNew(String id, String eventType, String source) Records the event as RECEIVED if its id has not been seen before.
-
Constructor Details
-
Inbox
public Inbox(org.jdbi.v3.core.Jdbi jdbi)
-
-
Method Details
-
initSchema
public void initSchema() -
markReceivedIfNew
Records the event as RECEIVED if its id has not been seen before.- Returns:
trueif this is the first sighting (caller should process it),falseif it is a duplicate (caller should skip).
-
markProcessed
-
markFailed
-