How to write a Abortable Cron Job in Hybris | explain how to make Abortable Cron Job

In my latest Hybris Interview, I got question related Abortable Cron Job means How to Abort a Cron Job?
Let’s first understand it, first assume that from last few hours your Cron Job is running and now i want to Abort this Cron Job then how can i do it.
Concept: You can only abort those Cron Job which satisfies below two conditions 
A. During creation of your cron job override method isAbortable() and make return      it TRUE means now you can Abort this Cron job.
B. Second through Configurable in your Spring.xml file as below
   <property name="abortable" value="true"/>
After above those you can abort your cron job means your Cron Job is Abortable 
Also you can abort by below code
cronJobService.requestAbortCronJob(running_cronjob_code);

A abortable cron job's result as ERROR and status as ABORTED

No comments:

Post a Comment