We are using spring integration/spring batch job to run jobs within multiple jboss nodes connected to the common ActiveMQ queue. We have configured auto startup as false for inbound gateway listening to the queue/channel. Problem with auto-start as true is that if inbound gateway has more concurrent consumers property, then those many number of consumer threads would be active in all nodes started during server startup even through frequency of the job requiring these consumer threads is very rare. In this scenario, spring batch job gets triggered in one of the 4 nodes. We can make use of control bus to start inbound gateway component when the job starts, it works for the same JVM. But in the worker nodes ( running in different JVM), how do we send the control bus message to start the inbound gateway component so that they start consuming the message put by the triggering job ?
The Control Bus is just an endpoint to consume messages from it input channel. The channel could be an in-memory one, or distributed, based on some shared store. For example, the mention ActiveMQ is just a JMS vendor, so you can use a JMS Inbound Endpoint to consume command messages from ActiveMQ topic and produce it to that Control Bus input channel: https://docs.spring.io/spring-integration/docs/current/reference/html/jms.html#jms-message-driven-channel-adapter