Sep 12th, 2010, 06:29 AM
Listening program times out?
I have a spring application which receives messages from a rabbitMQ server and act depending of how the message "looks". I am using a fairly standard approach I guess with a SimpleMessageListenerContainer and a MessageListenerAdapter. I am using google protocol buffers to "encode" the message and depening of some fields in the message my spring application does different stuff. The spring application is kind of a event driven service and it does not get messages very often at all, like 5 tasks a day. ( Not sure if this is the best approach to use messaging then but I "have" to implement this way because the giver of the assignment wants it this way )
The program works fine except in one case. One "messagetype" which come rarely like once every 3rd day takes long time to process, like 2 hours. It does what it should but after it has finished the whole spring application terminates. So the listener is terminated as well for some reason. It doesnt crash it is just terminated. I am using eclipse for development and it is easy to see that it has stoped.
Does the listener time out or something because that "message-type" take so long time to process? It might be a bad idea to lock up the listener so long anyway with a long processing time, should I be better off by launching a new thread and then "release" the listener so it can listen for new messages?
Any input would be appreciated, my approach here might be quite bad and I don't understand why the program terminates. Thought the listener would be active for inifinity ( in theory at least =)
Sep 12th, 2010, 05:02 PM
Just to clarify: you run your app in standalone mode (outside of Eclipse), and it exits without an error after processing a specific type of message. Is it correct?
Sep 13th, 2010, 02:57 AM
Ye it exits without an error after processing a specific type of message but I run it in Eclipse. I just start it through Eclipse. And you can see under the debug-view when a program has finished in eclipse.
Sep 13th, 2010, 08:52 AM
Try to run it in standalone mode, without Eclipse, and see if the problem disappears.