Use composite CronJob in Hybris

Hybris Logo

1. Overview

In Hybris, a composite cronJob is a composition of multiple cronJobs used when we need to run a bundle of cronJobs successively.  It is often referred as an ordered all or nothing execution, e.g. MediaImportComposite composed of MediaImportCronJob and MediaConversionCronJob.

This is an overview of how composite cronJob work.

Overview composite cronjob in Hybris

In this article, I will show you how to create a composite cronJob.

2. Implementation

Let’s assume that we have two cronJobs (totoCronJob and fooCronJob) that we want to run in order, refer to this article for more details on how to create a cronJob.

1. Create two instances of the CompositeEntryModel :

INSERT_UPDATE CompositeEntry  ;code[unique=true]  ;executableCronJob(code)
                              ;totoCronJobEntry   ;totoCronJob
                              ;fooCronJobEntry    ;fooCronJob

2. Create an instance of the CompositeCronJobModel and attach the composite entries to it.

INSERT_UPDATE CompositeCronJob  ;code[unique=true]    ;job(code)              ;compositeEntries(code)           ;sessionUser(uid)[default=admin]  ;sessionLanguage(isocode)[default=en]
                                ;helloCompositeCronJob;compositeJobPerformable;totoCronJobEntry, fooCronJobEntry

3. Run your composite cronJob from HMc.

Composite conjob in hmc hybris


Leave a Reply

1 Comment threads
2 Thread replies
Most reacted comment
Hottest comment thread
3 Comment authors
shivaMouad EL Fakirayoub Recent comment authors

This site uses Akismet to reduce spam. Learn how your comment data is processed.

newest oldest most voted
Notify of

Nice Article (y), What happens when a composite entry Crashes (continue the the execution of other entries or abort)? and in this case what is the status of the Composite cronjob ?