Question

We are using Spring JMS to read messages from an Oracle AQ queue.

When we process those messages, we send them out the door to a vendor product using sockets. On startup, we need to initiate the connection to the vendor so that messages can be sent,. The past few days, I noticed that messages were being read from the queue before our connection to the vendor was established.

Is there any way to stop the JMS Listener from starting until all our other beans are loaded.

Was it helpful?

Solution

You may use the @DependsOn annotation (or depends-on XML attribute) to make your JMS listener wait for another bean (eg your message-sending component) to be initialised.

See the Spring documentation here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top