Dec 15th, 2010, 04:56 PM
Delay Message Consumption
I have a web app using Spring-AMQP, and spring 3.0.4 running in Glassfish3.
It is setup to correctly consume messages off of the queue, ack them, etc....
Problem that we found is this. When doing local testing things run fine as the container is started before the app is deployed. However, when moving to our test env, the container occasionally gets restarted with the application already deployed. When this occurs we are seeing spring init and start pulling the messages from Rabbit before the rest of the app is started (namely the boostrapServlet we created to get around a ehcache problem). But the bigger issue is that when it starts, it creates nightmare scenarios for Glassfish, which is no longer able to return that it successfully started. Although I can tail log files and see that it is running.
This is a significant problem, and one that we will surely run into in prod. We are initializing spring using the context loader listener as recommended.
Any ideas on how to get spring-amqp to delay pulling messages from the queue until after Glassfish finishes starting up?