I've been learning Spring Integration for about a month now, and it suddenly dawned on me: what if you have the requirement to only have one instance of an IntegrationFlow
at any point in time, but you have multiple instances of the Spring application running in the same environment?
Meaning, I might have, say, 3 nodes/instances of my application running in the dev environment, and all 3 have @Configuration
source files defining the same IntegrationFlow
bean. But I only want one of the 3 to be running the flow at a time. This sounds like a problem solved in the leader election space. I'm tempted to use something like Consul or even ZK but figured I would reach out to the community in case SI or even Spring in general can offer an easier solution that doesn't come with all the operational overhead and infrastructure of running those consensus systems.
Thanks in advance for any-and-all steering!
See the documentation:
https://docs.spring.io/spring-integration/docs/current/reference/html/endpoint.html#endpoint-roles
and
https://docs.spring.io/spring-integration/docs/current/reference/html/endpoint.html#leadership-event-handling
Currently, Zookeeper and Hazelcast are supported.
https://docs.spring.io/spring-integration/docs/current/reference/html/zookeeper.html#zk-leadership
https://docs.spring.io/spring-integration/docs/current/reference/html/hazelcast.html#hazelcast-leader-election