문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top