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

 

5 4 votes
Article Rating
Subscribe
Notify of
guest

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

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
ayoub
ayoub
4 years ago

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 ?

shiva
shiva
Reply to  Mouad EL Fakir
4 years ago

Hi Mouad EL Fakir,
I have created Composite cronjob with 3 entries. Composite cronjob is not failing even first entry getting failed. can you please help me.

3
0
Would love your thoughts, please comment.x
()
x