How benhendayoussef/idempotency-spring-boot-starter works
This is a Spring Boot idempotency library: it protects annotated or filter-mode HTTP handlers from duplicate execution, replaying a stored response for repeated keys. The principal flow claims a scoped, request-fingerprinted key, invokes the handler only for the claim winner, then stores its response or releases the claim according to the outcome. The graph also shows alternate persistence, reactive support, configuration, and operational inspection. Core aspect, store-selection, and reactive implementation details are inferred from documented capabilities and the file tree; their source was not sampled.
Main entry points: IdempotencyAspect.java Idempotency aspect · IdempotencyStore.java Store interface · IdempotencyFilter.java Servlet filter mode · IdempotencyAutoConfiguration.java Boot auto-configuration
Components 22
Request handling
- Idempotency aspect
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/IdempotencyAspect.java - Servlet filter mode
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/filter/IdempotencyFilter.java - Response capture
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/filter/CapturedResponse.java - Exchange context filter
idempotency-webflux/src/main/java/io/github/benhendayoussef/idempotency/webflux/internal/IdempotencyExchangeContextFilter.java - Reactive aspect
idempotency-webflux/src/main/java/io/github/benhendayoussef/idempotency/webflux/internal/ReactiveIdempotencyAspect.java
Idempotency core
- Argument fingerprint
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/ArgumentFingerprinter.java - Key composition
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/IdempotencyKeyComposer.java - Scope resolution
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/scope - Store interface
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/api/IdempotencyStore.java
Persistence
- Memory store
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/InMemoryIdempotencyStore.java - Caffeine store
idempotency-store-caffeine/src/main/java/io/github/benhendayoussef/idempotency/store/caffeine/internal/CaffeineIdempotencyStore.java - JDBC store
idempotency-store-jdbc/src/main/java/io/github/benhendayoussef/idempotency/store/jdbc/internal/JdbcIdempotencyStore.java - Redis store
idempotency-store-redis/src/main/java/io/github/benhendayoussef/idempotency/store/redis/internal/RedisIdempotencyStore.java
Spring integration
- Idempotency settings
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/config/IdempotencyProperties.java - Boot auto-configuration
idempotency-spring-boot-starter/src/main/java/io/github/benhendayoussef/idempotency/autoconfigure/IdempotencyAutoConfiguration.java - Problem responses
idempotency-core/src/main/java/io/github/benhendayoussef/idempotency/internal/IdempotencyExceptionHandler.java
Operations
- Management endpoint
idempotency-spring-boot-starter/src/main/java/io/github/benhendayoussef/idempotency/autoconfigure/IdempotencyEndpoint.java - Metrics and tracing
idempotency-spring-boot-starter/src/main/java/io/github/benhendayoussef/idempotency/autoconfigure/IdempotencyMetricsAutoConfiguration.java - JDBC record sweeper
idempotency-store-jdbc/src/main/java/io/github/benhendayoussef/idempotency/store/jdbc/internal/IdempotencyRecordSweeper.java
Other components
- HTTP client
- Application handler
- Redis or SQL database
Connections 34
- HTTP client → Idempotency aspect: sends request
- Idempotency aspect → Argument fingerprint: fingerprints arguments
- Idempotency aspect → Key composition: composes key
- Idempotency aspect → Scope resolution: resolves namespace
- Idempotency aspect → Store interface: claims or reads
- Idempotency aspect → Application handler: invokes on claim
- Application handler → Idempotency aspect: returns response
- Idempotency aspect → Store interface: completes or releases
- HTTP client → Servlet filter mode: sends request
- Servlet filter mode → Key composition: composes key
- Servlet filter mode → Store interface: claims or reads
- Servlet filter mode → Application handler: dispatches on claim
- Servlet filter mode → Response capture: captures response
- Servlet filter mode → Store interface: completes or releases
- Idempotency aspect → Idempotency settings: reads settings
- Servlet filter mode → Idempotency settings: reads settings
- Store interface → Memory store: implemented by
- Store interface → Caffeine store: implemented by
- Store interface → JDBC store: implemented by
- Store interface → Redis store: implemented by
- Caffeine store → Redis or SQL database: stores records
- JDBC store → Redis or SQL database: stores records
- Redis store → Redis or SQL database: stores records
- Exchange context filter → Reactive aspect: provides exchange context
- HTTP client → Exchange context filter: sends reactive request
- Reactive aspect → Store interface: claims and replays
- Reactive aspect → Application handler: invokes on claim
- Boot auto-configuration → Idempotency aspect: configures
- Boot auto-configuration → Servlet filter mode: configures
- Boot auto-configuration → Idempotency settings: binds settings
- Problem responses → HTTP client: returns problem response
- Management endpoint → Store interface: inspects or evicts
- Metrics and tracing → Idempotency aspect: observes requests
- JDBC record sweeper → JDBC store: removes expired rows