'How to add scheduled job to all nodes in java springboot cluster?
We have two springboot servers. We use nginx so that the user request will be sent to one of the server node.
Now we want to achieve that:
After user inputs three string in the page "20220512 20:00" "a" "123" and clicks submit button, at 2022-05-12 20:00, a key-value element "a"->123 will be added into a global variable conCurrentHashMap in XXXController of both server, which means in each server's XXXController, "a"->123 will be in the map.
We try to find how to use quartz to add a scheduled job for all nodes in cluster but it seems that it's not supported (quartz will only let one server node to do the scheduled job)
We must store element in map, not store it in redis (if element is in redis, then each server can easily get this element). And we can't use any MQ and zookeeper in server.
Do you know the good solution for this issue? Thank you very much!!!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|