I would say of the top of my head I would create a custom router which would have references to pending-channel and processing-channel. It would also have an instance variable of currentChannel which would be set by Cron-based tasks using Spring 3.0 scheduling support
Something like this:
Code:
public class TimeBasedRouter {
private MessageChannel processingChannel;
private MessageChannel pendingChannel;
private MessageChannel currentChannel;
public TimeBasedRouter(MessageChannel processingChannel, MessageChannel pendingChannel){
this.processingChannel = processingChannel;
this.pendingChannel = pendingChannel;
}
public void resetCurrentChannelToPending(){
this.currentChannel = pendingChannel;
}
public void resetCurrentChannelToProcessing(){
this.currentChannel = processingChannel;
}
public MessageChannel route(){
return currentChannel;
}
}
Code:
<int:router ref="timeBasedRouter" method="route" input-channel="input"/>
<int:channel id="processingChannel"/>
<int:channel id="pendingChannel">
<int:queue/>
</int:channel>
<bean id="timeBasedRouter" class="foo.bar.TimeBasedRouter">
<constructor-arg ref="processingChannel"/>
<constructor-arg ref="pendingChannel"/>
</bean>
<task:scheduled-tasks>
<task:scheduled ref="timeBasedRouter" method="resetCurrentChannelToProcessing" cron="0 0 6 ? * MON-FRI"/>
<task:scheduled ref="timeBasedRouter" method="resetCurrentChannelToPending" cron="0 0 18 ? * MON-FRI"/>
</task:scheduled-tasks>
As you can see the current channel will be set by the scheduled task on the actual router.