ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » messageConsumer doesn't throw except. when connection broken

Post new topic  Reply to topic
 messageConsumer doesn't throw except. when connection broken « View previous topic :: View next topic » 
Author Message
gstasica
PostPosted: Wed Sep 01, 2010 11:57 am    Post subject: messageConsumer doesn't throw except. when connection broken Reply with quote

Newbie

Joined: 12 Aug 2010
Posts: 4

hi,

while trying to implement reconnect feature for my MQ 7.0.1.2 client i came across situation that despite unplugging MQ server from the network my remote clients i.e. MessegeConsumers (messegeConsumer.receiveNoWait() method) don't throw any exceptions. I would assume that once the cable has been unplugged every call to this method would throw some exception.
In my application i use 100 client threads being connected to a different queue but sharing the same connection object (every thread gets its own session object thought). If i register exceptionlistener on a connection object and unplug MQ after about 3 minutes exceptionlistener gets called but this doesn't have any impact on the messegeConsumer.
How is it possible that despite connection being broken messegeConsumers don't see it? What would be the best approach of implementing reconnect feature ?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Sep 01, 2010 2:20 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You have to use an ErrorListener and an ExceptionListener. They attach to the connection.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
gstasica
PostPosted: Thu Sep 02, 2010 12:45 am    Post subject: Reply with quote

Newbie

Joined: 12 Aug 2010
Posts: 4

thanks for your reply,

what ErrorListener do you mean as one can only setExceptionListener on a connection object which i do?
The other question is why my message consumers don't throw exceptions when their connection to the server has been broken (making a messageConsumer.receiveNoWait() method call doesn't make any sense here as obviously i won't read anything)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Sep 02, 2010 8:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

OK so let's rollback a little.

You have a connection with ErrorListener.
You retrieve a message with no wait and you are unhappy that you did not receive an exception...

  • On the receive nowait there was no bitstream so the program just goes on --- standard behavior
  • The error listener does get the error but only according to the time outs you have defined for the lower level protocols (TCP/IP)


Ok. So I do not quite understand what your problem is. As long as TCP/IP has not identified the fact that the connection is broken, your ErrorListener will not receive any error. This is standard behavior. Once the lower level protocol has notified the event, you will receive an error and the receivenowait() should also fire an exception.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
JLRowe
PostPosted: Fri Sep 03, 2010 2:38 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

turn on keepalive, this will let your client know when the connection has been broken
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » messageConsumer doesn't throw except. when connection broken
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.