Use composite CronJob in Hybris
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.
In this article, I will show you how to create a composite cronJob.
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
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.
Software Craftsmanship, Stackextend author and Full Stack developer with 6+ years of experience in Java/Kotlin, Java EE, Angular and Hybris…
I’m Passionate about Microservice architectures, Hexagonal architecture, Event Driven architecture, Event Sourcing and Domain Driven design (DDD)…
Huge fan of Clean Code school, SOLID, GRASP principles, Design Patterns, TDD and BDD.