3. Security and Validation

idempotency

Prevents duplicate request processing based on a dynamic idempotency key.

This interceptor evaluates an expression (e.g., from headers or body) to extract an idempotency key. If the key has already been processed, it aborts the request with a 409 response.

Useful for handling retries from clients to avoid duplicate side effects like double payment submissions.


Can be used in:

serviceProxy, api, global, chainDef, for, choose, stompProxy, if, registration, wsStompReassembler, internal, interceptor, chain, bean, transport and soapProxy

Attributes

NameRequiredDefaultDescriptionExample
language false SpEL
Language used to interpret the expression (e.g., spel, jsonpath, xpath). Determines how the key string will be evaluated.
jsonpath
expiration false 3600
Time in seconds after which idempotency keys automatically expire. Useful to avoid memory leaks in long-running systems. Common values:
  • 300 seconds = 5 minutes
  • 86400 seconds = 1 day
  • 604800 seconds = 1 week
  • 2592000 seconds = 1 month (30 days)

-
key true - Expression used to extract the idempotency key from the exchange. Can be an XPath, JSONPath, header, or other supported syntax depending on the language.
$.id