简体   繁体   中英

Spring integration Scheduled job

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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM