3
votes

I have written a scheduler in my spring integration application and it is working as expected for success scenarios. i have a question regarding error scenario's and how to handle it. This is the definition of the scheduler -

<task:scheduled-tasks>
    <task:scheduled ref="scheduler" method="process" trigger="cronSchedule" />
</task:scheduled-tasks>

<bean id="cronSchedule" class="org.springframework.scheduling.support.CronTrigger">
    <constructor-arg type="java.lang.String" value="data"/>
    <constructor-arg type="java.util.TimeZone" ref="timeZone"/>
</bean>

What I want to know is there a way to define a error channel for this scheduler like we do in spring chain? I have a global errorChannel defined in my spring integration and i was hoping to invoke it when there is any error during the execution of this scheduler. Can someone help me with possible configuration ot handle this situation?

1

1 Answers

4
votes

Consider using a cron poller with an inbound-channel-adapter instead of a scheduled task; then you can add an error-channel to the poller to handle errors (errors will go to the global error channel by default).