Explain how to Create Cron Job in Hybris

prashant kumar picture prashant kumar · May 2, 2015 · Viewed 15.7k times · Source

I did my research but couldn't find the authentic answer. Any inputs from hybris experts highly appreciated

Answer

Manohar Ch picture Manohar Ch · May 12, 2015
  1. Cronjob: The job to be performed. For this Create an item type extending from CronJob.
  2. Job: Where the actual cronjob logic will be written. For this Create a class extending from AbstractJobPerformable<...abovegeneratedModel> and override the perform() method. Here perform method will contain actual job logic.
  3. Define the above Job class as a bean in xxxcore-spring.xml.
  4. Go to hmc-->System-->Right click on Cronjobs and Create your new cronjob.
  5. Trigger: Holds cron expression when to fire cronjob. Add the trigger conditions through TimeSchedule tab.
  6. Click StartCronJob Now to schedule the cronjob.

You can also use impex script to create trigger as thijsraets said.

INSERT_UPDATE Trigger;cronJob(code)[unique=true];cronExpression
;myCronJob;30 23 14 2 5 ? 2015