Core concept of running Cron Job in Clustering environment in Hybris | Cron job tutorial

Hello Guys,
Have you ever think that How Cron Job is run in cluster environment. is it run on every nodes or only in a single node ?. SO lets discuss it.
Core Concept : Cron job Always run in Single Node only 
During to creation of Cron Job you can define on which node it can execute mean you can set Node on which it always execute
everyReplyCronJob.setNodeID(1);
modelService.save(everyReplyCronJob);
After above code everyReplyCronJob will always run on node 1 in that cluster environment and if you not set node then it can be run any one of node in that cluster environment but only one node for that time

Now  After  release of Hybris 5.5.1 and later version , you can assign your cron job to group of nodes means if there is no available a node then it will execute on any other node of that groups
For that you need to do below
You need to define group of node in Local.properties file as below
cluster.node.groups= group name, another group name
After that you need to do code as below


 everyReplyCronJob.setNodeGroup(“your node group”);

No comments:

Post a Comment