As we already discussed in the introduction section, there could be a difference in the rate of messages produced and its rate of consumption—what if the consumer is slow? Since external systems are involved, it might not be in our control to influence the rate at which the producer produces messages. This is where a delayer is used. A delayer is a simple endpoint that introduces a delay before the message is delivered to the next endpoint. The most notable part is that the original sender is neither blocked nor slowed down; rather, the delayer will pick a message from a channel and use an instance of
org.springframework.scheduling.TaskScheduler to schedule its delivery to the output channel after a configured interval. Let's write a simple delayer:
<int:delayer id="feedDelayer" input-channel="feedInput" default-delay="10000" output-channel="feedOutput"/>
This simple configuration will delay the delivery of messages on the input channel to the output channel by 10 seconds...