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 » ExceptionListener not called on transactions log rolled back

Post new topic  Reply to topic
 ExceptionListener not called on transactions log rolled back « View previous topic :: View next topic » 
Author Message
skibodido
PostPosted: Wed Mar 05, 2014 3:39 am    Post subject: ExceptionListener not called on transactions log rolled back Reply with quote

Newbie

Joined: 05 Mar 2014
Posts: 5

Summary:

-I open a connection and register an ExceptionListener for connection drops
-Then create a non transacted session and register a long running MessageListener
-Another unlrelated process causes the MQ transaction logs to roll back
-My message listener stops receiving messages, but the ExceptionListener.onException is never called to notify there is an issue
-No exceptions are thrown apart from when I shut down my java application and the connection tries to close

Details:

Version:
WebSphere MQ V7.1.0.1

Java code:
Code:
    connection = qcf.createConnection();
    final Session receiverSession = connection.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
    final MessageConsumer messageConsumer = receiverSession.createConsumer(inboundQ);
    connection.setExceptionListener(new ExceptionListener() {
      @Override
      public void onException(JMSException exception) {
        // do something about broken connection
      }
    });


MQ Log when transaction log rolled back:
Code:
AMQ7469: Transactions rolled back to release log space.


When I later manually shutdown java connection:
Code:
Exception:
com.ibm.msg.client.jms.DetailedTransactionRolledBackException: JMSCMQ0002: The method 'MQCMIT' failed. A WebSphere MQ call failed. Please see the linked exception for more information.
com.ibm.msg.client.wmq.common.internal.Reason.reasonToException:576
com.ibm.msg.client.wmq.common.internal.Reason.createException:216
com.ibm.msg.client.wmq.common.internal.Reason.createException:254
com.ibm.msg.client.wmq.internal.WMQSession.syncpoint:1534
com.ibm.msg.client.wmq.internal.WMQSession.commit:726
com.ibm.msg.client.jms.internal.JmsSessionImpl.commitTransaction:2231
com.ibm.msg.client.jms.internal.JmsSessionImpl.close:388
com.ibm.msg.client.jms.internal.JmsConnectionImpl.close:293

Exception:
com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '1' ('MQCC_WARNING') reason '2003' ('MQRC_BACKED_OUT').
com.ibm.msg.client.wmq.common.internal.Reason.createException:204
com.ibm.msg.client.wmq.common.internal.Reason.createException:254
com.ibm.msg.client.wmq.internal.WMQSession.syncpoint:1534
com.ibm.msg.client.wmq.internal.WMQSession.commit:726
com.ibm.msg.client.jms.internal.JmsSessionImpl.commitTransaction:2231
com.ibm.msg.client.jms.internal.JmsSessionImpl.close:388
com.ibm.msg.client.jms.internal.JmsConnectionImpl.close:293
com.ibm.mq.jms.MQConnection.close:93
Back to top
View user's profile Send private message
JosephGramig
PostPosted: Wed Mar 05, 2014 5:38 am    Post subject: Re: ExceptionListener not called on transactions log rolled Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1230
Location: Gold Coast of Florida, USA

skibodido wrote:
Details:

Version:
WebSphere MQ V7.1.0.1


Really? To begin with "why doesn't this work?", start with "is my mainteance up to date?"

Your way off. Apply maintenance and retest. Remember, never copy MQ JAR files around. Always use a valid install and point to the JAR files from the CLASSPATH.
Back to top
View user's profile Send private message AIM Address
fjb_saper
PostPosted: Wed Mar 05, 2014 6:18 am    Post subject: Reply with quote

Grand High Poobah

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

From the description I'd say working as designed.
The ExceptionListener is not a convenient way to let you know of problems in your code or environment, like not being setup to deal with a poison message.
It is there to warn you about structural problems, like your MQ connection dropped (problems in the network) etc...

In your case the connection is fine. The problem you have is that you are not dealing with a poison message, and this failure to cope with the poison message is shutting down your MessageListener / MDB.... Why would you expect the ExceptionListener to even know about this?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Mar 05, 2014 6:20 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

fjb_saper wrote:
The problem you have is that you are not dealing with a poison message, and this failure to cope with the poison message is shutting down your MessageListener / MDB....


No.

That's not remotely the problem as described.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 05, 2014 6:26 am    Post subject: Reply with quote

Grand High Poobah

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

Sorry I just read transaction log and missed MQ Transactionlog.

However would you expect that to generate a behavior like a poison message or would you expect an Exception to be generated by the Exception listener?

I'd say as long as the connection is not affected there is no Exception being propagated through the ExceptionListener...

If an unrelated problem, like no log space causes a roll back of transactions and the MessageListener is unable to complete the transaction beyond the number of retries specified, it will stop listening... (standard behavior).

The application needs to find a different way to alert the user about the problem. Monitoring comes to mind.


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
skibodido
PostPosted: Wed Mar 05, 2014 11:11 am    Post subject: Reply with quote

Newbie

Joined: 05 Mar 2014
Posts: 5

First of all, thanks for the updates...much appriciated.

I accept that the connection is not breaking, so expecting the ExceptionListener to be called was a poor expectation on my part.

However my session/listener is non-transacted, so I don't understand why the transaction rollback caused by another application should affect my messageListener?

I am looking for a pure java based solution to detect this severed messageListener scenario.

I could just periodically recycle my connection or messageListener, but that just seems like a poor hack.

I was wondering if switching my session to transacted might magically fix my issue (with a session.commit() after each message I consume)
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 05, 2014 2:40 pm    Post subject: Reply with quote

Grand High Poobah

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

How do you know that your session was not transacted? In the J2EE environment the global UOW will override the JMS session settings, unless you have defined the transactionality at the method level in the deployment descriptor of your MDB.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
skibodido
PostPosted: Wed Mar 05, 2014 11:30 pm    Post subject: Reply with quote

Newbie

Joined: 05 Mar 2014
Posts: 5

I'm not in j2ee container. This is a standalone application where I all of my jms objects are created manually (well configured manually)

Just to double check I tried calling session.commit() after consuming a message and it blew up saying 'you can't commit in non-transacted session'
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 06, 2014 3:24 am    Post subject: Reply with quote

Grand High Poobah

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

Well switching to a transacted session might not magically fix your issue. It might however force a JMSException on the commit letting you know that there is something wrong going on...

And of course to make it work you will be forced to fix the root cause ...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
skibodido
PostPosted: Tue Mar 25, 2014 1:53 am    Post subject: Reply with quote

Newbie

Joined: 05 Mar 2014
Posts: 5

Unfortunately I am still having this issue where my MessageListener dissappears without a trace. I only see that it was broken when I shut down our application.

Does anyone know a way (ideally using an MQ connection setting or pure jms spec) of finding out when my MessageListener stops listening?

Are there any settings regarding how many time a MessageListener retries before giving up etc...

When I shutdown the application, the connection.close() seems to identify there was an issue, so I find it hard to believe that I can't find out the same thing whilst it is running and supposidly listening.

From searching through this forum I can see others having issues with same problem...but no solutions yet
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Mar 25, 2014 3:26 am    Post subject: Reply with quote

Grand High Poobah

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

Did you check if there was an APAR for this issue, or if using the latest version would fix it?
_________________
MQ & Broker admin
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 » ExceptionListener not called on transactions log rolled back
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.