Package com.babelqueue.idempotency
Class Idempotent
java.lang.Object
com.babelqueue.idempotency.Idempotent
Wraps a
Handler so a message whose meta.id was already processed
successfully is skipped instead of run again (ADR-0022) — the Java mirror of the PHP
Idempotent::wrap, Go idempotency.Wrap, Python wrap, and Node
Wrap helpers.
Store store = new InMemoryStore();
Handler handler = Idempotent.wrap(store, env -> process(env));
A previously-seen id returns early (so an adapter acks it and the broker stops
redelivering); a throwing handler leaves the id unmarked so a redelivery runs it again
(retry / dead-letter still apply); a message with no usable meta.id runs
unchanged.
-
Method Summary
-
Method Details
-
wrap
Returnshandlerwrapped with dedupe onmeta.idagainststore.- Parameters:
store- the dedupe recordhandler- the handler to guard- Returns:
- the wrapped handler
-