How to make cronjob run on some servers(in case of load balancer or cluster ) and but not on others?

This scenario can be achieved using Nodes concept in hybris.

1. First you need to define applicable nodes in local.properties using cluster.node.groups property such as


cluster.node.groups = backoffice,storefront .


2. Assign the cronjob to group of nodes by 2 ways :

 a) When you define the cronjob then use method .setNodeGroup("nameofnodegroup") like .setNodeGroup("storefront ").

b) Using Impex :


INSERT_UPDATE CronJob; code[unique=true];job(code);nodeGroup
;myCronJob;myJob;storefront


Whenever next time the cronjob is going to it will trigger on the nodeGroup defined .

Post a Comment