Search code examples
spring-integrationspring-integration-dsl

Spring Integration Jdbc Backed QueueChannel Delayed Delivery


Is it possible to achieve delivery delay when using an QueueChanne backed by JdbcChannelMessageStore? The idea is to implement an exponential retry to a target Jms from the QueueChannel. Please suggest.


Solution

  • I see several options.

    1. Obvious one: use a RequestHandlerRetryAdvice on your JMS service activator: https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#retry-advice. Although this one does not provide a persistence in between retries.

    2. Use a ReceiveMessageAdvice with a DynamicPeriodicTrigger to modify its duration according to the exception and retry state. See SimpleActiveIdleReceiveMessageAdvice for inspiration: https://docs.spring.io/spring-integration/docs/current/reference/html/core.html#conditional-pollers

    3. Use a Delayer with a JdbcMessageStore t delay messages when they have been retried: https://docs.spring.io/spring-integration/docs/current/reference/html/messaging-endpoints.html#delayer