-
1. Re: session auto close problem
ataylor Aug 11, 2011 11:45 AM (in response to galanfish)Firstly your session is being closed because it is being garbage collected. regarding consumers just close it once you have finished using it.
tbh i'm not really sure whatyour asking here
-
2. Re: session auto close problem
galanfish Aug 11, 2011 12:02 PM (in response to ataylor)sorry for my english.
i use the MessageHandler as listener
i call consumer#setMessageHandler, then session#start
in this situation, need i close the consumer?
-
3. Re: session auto close problem
ataylor Aug 11, 2011 12:22 PM (in response to galanfish)just close the consumer once you dont need it anymore
-
4. Re: session auto close problem
galanfish Aug 11, 2011 1:34 PM (in response to ataylor)and even that the listener is still works? setMessageHandler -> session#start -> consumer#close... and all done?
-
5. Re: session auto close problem
ataylor Aug 11, 2011 7:08 PM (in response to galanfish)and even that the listener is still works? setMessageHandler -> session#start -> consumer#close... and all done?
I dont really understand what you are sayng here
-
6. Re: session auto close problem
clebert.suconic Aug 11, 2011 7:51 PM (in response to ataylor)Someone asked something similar on Stack Overflow (and I have been following stack over flow recently):
Java WeakReferences = Understandingproblem (with HornetQ JMS Implementation)?
-
7. Re: session auto close problem
galanfish Aug 11, 2011 10:25 PM (in response to ataylor)oh, sorry again.. actually i was asking: whether the MessageHandler will still work even after i close the consumer which the MessageHandler is set on. i made a test just now, it seems that the listener is not work anymore after i close the consumer?
-
8. Re: session auto close problem
clebert.suconic Aug 11, 2011 11:47 PM (in response to galanfish)You closed the consumer, how you would expect the listener still receiving messages from the consumer?
-
9. Re: session auto close problem
galanfish Aug 12, 2011 12:51 AM (in response to clebert.suconic)so, once i set up a message handler, i should not call consumer#close?
-
10. Re: session auto close problem
ataylor Aug 12, 2011 6:05 AM (in response to galanfish)so, once i set up a message handler, i should not call consumer#close?
No, the listener is bound to the life cycle of the consumer as is the consumer with the sessiion and the session with the connection.
-
11. Re: session auto close problem
galanfish Aug 12, 2011 8:24 AM (in response to ataylor)then i have to keep the consumer/session open, but how can i prevent hornetq auto-closing the session?
-
12. Re: session auto close problem
ataylor Aug 12, 2011 8:45 AM (in response to galanfish)This is basic Java concepts, if you let your session object go out of scope it will be garbage collected and closed.