0

I am building a application that uses quartz scheduler which is triggered every 30 min. Since we have clustered servers, if the application is deployed it will do the job twice , which we don't want to happen. Therefore we decided to use socket approach which requires port and ip . My question is , how would i implement socket approach if only one instance is to run in whole clustered environment ? Any suggestion or help and example code will be highly appreciated.

nepJava
  • 81
  • 1
  • 1
  • 4

1 Answers1

0

You may use a approach of JMS or similar, where you publish the task to be done on a Queue. With the nature of queue, that only one consumer can consume that message, you can be sure one of the instances should pick the task and run.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136