Skip to main content

Module idempotent_consumer

Module idempotent_consumer 

Source
Expand description

Idempotent Consumer EIP — outcome-aware Segment implementation.

Implements the Idempotent Consumer pattern at the OutcomePipeline layer (one layer above Tower), so that PipelineOutcome::Stopped from the child sub-pipeline propagates with the Exchange intact (ADR-0024, ADR-0025).

§Why Segment-mode (NOT Process-mode)

compose_pipeline() translates PipelineOutcome::Stopped → Ok(ex) for Tower Service<Exchange> consumers. If this EIP were a Tower Service, a duplicate-detected Stopped would become Ok(ex) and downstream steps would re-process the duplicate. By implementing OutcomePipeline directly, the segment returns PipelineOutcome::Completed(ex) for duplicates and skips the child sub-pipeline entirely.

§Contract C1

IdempotentRepository::contains returns Result<bool, CamelError> because backends (Redis, JDBC) can have transient read failures. The segment propagates Err as PipelineOutcome::Failed — it NEVER treats a failed read as “not a duplicate.”

Structs§

IdempotentConsumerSegment
Outcome-aware Idempotent Consumer segment.

Type Aliases§

MessageIdExpression
Synchronous closure that extracts the message-id key from an Exchange.