-
1. Re: ExceptionListener in HornetQ
leosbitto Apr 23, 2010 4:43 AM (in response to zenzei2k)Let me quote part of the chapter 4.3.8 of the JMS 1.1 specification for you: "If a JMS provider detects a problem with a connection, it will inform the
connection’s ExceptionListener, if one has been registered. ... A JMS provider should attempt to resolve connection problems itself prior to notifying the client of them.". The javadoc at http://java.sun.com/j2ee/1.4/docs/api/javax/jms/ExceptionListener.html states the same. So I would think that if the JMS provider is able to resolve the problem itself (like a successful transparent reconnecting to the server, for example), the ExceptionListener should not be called. -
2. Re: ExceptionListener in HornetQ
ataylor Apr 23, 2010 4:54 AM (in response to zenzei2k)It wouldnt make sense to do both, you either do the reconnect yourself or configure HornetQ to do it transparently.
-
3. Re: ExceptionListener in HornetQ
leosbitto Apr 23, 2010 5:06 AM (in response to ataylor)Andy Taylor wrote:
It wouldnt make sense to do both, you either do the reconnect yourself or configure HornetQ to do it transparently.
The main remaining question is: if HornetQ does successful transparent reconnect, would it call the ExceptionListener or not? And the less important question would be: if HornetQ is configured to do the transparent reconnect, but it is unable to do so (for example because no server is available), would it call the ExceptionListener? And one more question if the answer to the previous two questions would be true: how is the ExceptionListener able to distinguish between those two cases?
-
4. Re: ExceptionListener in HornetQ
ataylor Apr 23, 2010 5:41 AM (in response to leosbitto)Leos Bitto wrote:
Andy Taylor wrote:
It wouldnt make sense to do both, you either do the reconnect yourself or configure HornetQ to do it transparently.
The main remaining question is: if HornetQ does successful transparent reconnect, would it call the ExceptionListener or not? And the less important question would be: if HornetQ is configured to do the transparent reconnect, but it is unable to do so (for example because no server is available), would it call the ExceptionListener? And one more question if the answer to the previous two questions would be true: how is the ExceptionListener able to distinguish between those two cases?
if hornetq reconnects then the exception listeners won't get called, in effect as far as the client is concerned there has been no problem. depending on what reconnect attempts is set to, -1 is infinite i think, if the client cant reconnect then the exception listeners will be called.
also make sure u understand the difference between reconnect and reattach, this is explained in the manual.
-
5. Re: ExceptionListener in HornetQ
leosbitto Apr 23, 2010 6:27 AM (in response to ataylor)Andy Taylor wrote:
Leos Bitto wrote:
The main remaining question is: if HornetQ does successful transparent reconnect, would it call the ExceptionListener or not? And the less important question would be: if HornetQ is configured to do the transparent reconnect, but it is unable to do so (for example because no server is available), would it call the ExceptionListener? And one more question if the answer to the previous two questions would be true: how is the ExceptionListener able to distinguish between those two cases?
if hornetq reconnects then the exception listeners won't get called, in effect as far as the client is concerned there has been no problem. depending on what reconnect attempts is set to, -1 is infinite i think, if the client cant reconnect then the exception listeners will be called.
also make sure u understand the difference between reconnect and reattach, this is explained in the manual.
Thanks for the answers. Would you please answer the same questions with reattach instead of reconnect?
-
6. Re: ExceptionListener in HornetQ
zenzei2k Apr 23, 2010 8:03 AM (in response to ataylor)Hi Andy! Thanks for your help.
What your are saying is exactly what I think it should behave, but that isn't what I undestand by two things, first one comment of Tim Fox in the JIRA that post before
Since you're doing manual reconnection - i.e. you've coded your own reconnection code in your ExceptionListener, you should have reconnectAttempts set to zero (which is the default).
ReconnectAttempts determines how many times it will automatically try to reconnect after failure.
Having it automatically reconnect, only for you to then manually close and recreate again the connections does not make sense.And also because the pharse in section 34.4 of the manual
Please note, that when a client reconnects or re-attaches, any registered JMS ExceptionListener or core API SessionFailureListener will be called.
What I understand here is that if HornetQ succesfull reconnect or reattach, it will also call the ExceptionListener after that.
Of course I don't saying your are lying! I relly appreciate your help and I only want to undestand exactly whats the expected behave