Spring JMS and Loading of Listener
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开发者_JAVA百科 are loaded.
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.
精彩评论