This content has been marked as final. Show 7 replies
I'm using SunONE Message Queue 3.0.1 with durableAre you not receiving notification on the exception listener
subscribers. Is there a way for a subscriber to sense
the loss of connection to the broker as soon as it
when the connection closed ???
- synchronous (receive()) subscribers will receive an
exception in receive when the connection is closed
- asynchronous (onMessage) subscribers will NOT
receive an exception, however the application can
register an exception listener who will receive the
noticiation (and then notify the subscriber)
There are a few very rare cases where the client may
not receive the error. These occur when there is some
sort of network failure between the client and the broker.
The application ends up with a "half-open" connection
(the tcp stack has not realized that the connection has
gone because there has been no normal activity)
[see bug 4953659 for a workaround for this problem
if you run into it]
My subscribers are asynchronous, they implement ExceptionListener too, and I've registered them as exception listeners for the topic connection. What I saw is that if I disconnet the net cable of the machine where the message listeners have been started, then their onException method is called straightaway, but when the connection just times out gracefully (provided that is what really happens), I find the "Closing:..." in the broker log file, but it seems the onException isn't called on the client side or, at least, it isn't called as soon as the connection is lost.
Still, I have to say that I haven't had the chance to test the whole matter that much, because every time it takes some days for the connection to be lost after I start the message listeners.
I couldn't find the bug you were talking about in the bug database: the number you wrote is the bug ID, isn't it? I did my search at http://developer.java.sun.com/developer/bugParade/index.jshtml.
What IPlease read the section about "half-open" connections which
saw is that if I disconnet the net cable of the
machine where the message listeners have been
started, then their onException method is called
straightaway, but when the connection just times out
gracefully (provided that is what really happens),
was discussed above. The problem you are seeing is
because you have a "half-open" connection situation.
When you pull out a network cable, an application ONLY
receives notification from tcp if data is flowing on the system.
On the broker side, the connection will closed. This is because
the broker periodically "PINGS" the client to make sure that
it is still there (writing data on to the system) which allows
the broker to realize that the connection is gone.
The client does not currently send periodic pings to the
broker (see the bug I mentioned) so the broker will
receive an exception but the client will not.
Again .. please look at the bug I mentioned to get more
information about how to work around this type of problem
on the client
I've already tried to look for the bug you mentioned, but I couldn't find it. I searched by bug id 4953659.
Here's the workaround info from the bug:
If the client is only a subscriber, it can still generate traffic between the client and broker by either creating a session and closing it or creating a temporary topic and deleting it. If the client periodically does either of these things, it will trigger the ExceptionListener.onException.
hi my name is naveen,
I am also facing same problem,
iam using Message Listner and onMessage is not firing always, when i restart my server all message are getting up clear.
while restarting my server my servlet will create session and connection to JMS, its very strange problem, and iam not getting any Exceptions or Error messages.
how to implement Exception listner in JMS could you please let me know, and did you fine solution for this problem.
Please see MQ 4.5 doc on connection ping related properties
JMS ExceptionListener Java doc and specification