2

I'm using spring-integration to develop a service bus. I need to process some messages from the message-store at the specific time. For example if there is a executionTimestamp parameter in payload of the message it will be executed in specified time otherwise be executed as soon as message received. What kind of channel and taskExecutor I have to use? Do I Have to implement a custom Trigger or there is some conventional way to implement the message processing strategy?

Sincerely

1 Answers1

2

See the Delayer.

The delay handler supports expression evaluation results that represent an interval in milliseconds (any Object whose toString() method produces a value that can be parsed into a Long) as well as java.util.Date instances representing an absolute time. In the first case, the milliseconds will be counted from the current time (e.g. a value of 5000 would delay the Message for at least 5 seconds from the time it is received by the Delayer). With a Date instance, the Message will not be released until the time represented by that Date object. In either case, a value that equates to a non-positive delay, or a Date in the past, will not result in any delay. Instead, it will be sent directly to the output channel on the original sender’s Thread. If the expression evaluation result is not a Date, and can not be parsed as a Long, the default delay (if any) will be applied.

You can add a MessageStore to hold the message if you don't want to lose messages that are currently delayed when the server crashes.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179