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 » max uncommitted message limit...

Post new topic  Reply to topic
 max uncommitted message limit... « View previous topic :: View next topic » 
Author Message
kun.leeing
PostPosted: Mon Apr 27, 2009 6:36 pm    Post subject: max uncommitted message limit... Reply with quote

Disciple

Joined: 27 Sep 2008
Posts: 171

Hi, experts.

I never use any transaction in system. How does it give me limit of uncommitted message?

I just use pub/sub simply, but my clients can not receive message after getting MQJMS2002 exception. I can delay this error by changing the setting of max uncommitted message. But Why? And How can I resolve it ?

Thanks.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Apr 27, 2009 11:51 pm    Post subject: Re: max uncommitted message limit... Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kun.leeing wrote:
I never use any transaction in system. How does it give me limit of uncommitted message?


Because something's creating a unit of work implicitly.

kun.leeing wrote:
I just use pub/sub simply, but my clients can not receive message after getting MQJMS2002 exception.


This is a JMS error. What is the WMQ reason code in the linked exception?

kun.leeing wrote:
I can delay this error by changing the setting of max uncommitted message. But Why? And How can I resolve it ?


Ensure that all WMQ operations are properly committed. The WMQ reason code may give you additional clues.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kun.leeing
PostPosted: Tue Apr 28, 2009 10:36 pm    Post subject: Reply with quote

Disciple

Joined: 27 Sep 2008
Posts: 171

Thanks, vitor.

And there's no reason code returned, and only get that exception info from exception listener.

Quote:
Because something's creating a unit of work implicitly.

I don't know where is the unit of work, I do not use any work unit I thought.

So here is my simplified code which is the core of pub/sub part.

Subscriber


Code:
JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);

 JmsConnectionFactory cf = ff.createConnectionFactory();

cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);
              
cf.setIntProperty(WMQConstants.WMQ_PORT, port);
              
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);
              
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
              
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManagerName);
              
cf.setIntProperty(WMQConstants.WMQ_BROKER_VERSION, WMQConstants.WMQ_BROKER_V1);
              
cf.setStringProperty(WMQConstants.USERID, "mqm");
              
connection = cf.createConnection();
              
this.session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
                   
destination = this.session.createQueue(topic);

this.consumer = this.session.createConsumer(destination);
                    
this.consumer.setMessageListener(new MessageListener(){

   public void onMessage(Message message){

      TextMessage tMessage = (TextMessage) message;
                
      System.out.println(tMessage.getText()+ message.getJMSMessageID();
      }
   });

connection.start();

System.in.read(); // holding on


Publisher:


Code:
JmsFactoryFactory ff = JmsFactoryFactory.getInstance(WMQConstants.WMQ_PROVIDER);

JmsConnectionFactory cf = ff.createConnectionFactory();

cf.setStringProperty(WMQConstants.WMQ_HOST_NAME, host);
     
cf.setIntProperty(WMQConstants.WMQ_PORT, port);
     
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, channel);
     
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
     
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, queueManagerName);
     
cf.setIntProperty(WMQConstants.WMQ_BROKER_VERSION, WMQConstants.WMQ_BROKER_V1);
     
cf.setStringProperty(WMQConstants.USERID, "mqm");
     
connection = cf.createConnection();

sessionsnd = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
           
destination = sessionsnd.createTopic(topic);
     
MessageProducer producer = sessionsnd.createProducer(destination);
       
TextMessage tmessage = sessionsnd.createTextMessage(msg);
      
tmessage.setJMSExpiration(expiredtime);
      
producer.send(tmessage);
      
sessionsnd.close();
      
producer.close();



I don't know Where is the problem on code.

How can I resolve it?

Thanks, experts.
Back to top
View user's profile Send private message Send e-mail
kun.leeing
PostPosted: Tue Apr 28, 2009 10:41 pm    Post subject: Reply with quote

Disciple

Joined: 27 Sep 2008
Posts: 171

And plus

My app on C# using XMS seems no this problem and can receive messages continually. It seems not limited by the number of max uncommitted message. The code to some extent is same as the jms code.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Apr 28, 2009 11:39 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Ok, my Java (as any regular reader knows) sucks so take this with the proverbial pinch of salt ok?

Where is your Java running? Is it inside WAS, standalone, what? Also there doesn't seem to be anything in the code snippets you've provided that are closing the connections.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 28, 2009 11:43 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kun.leeing wrote:
My app on C# using XMS seems no this problem and can receive messages continually. It seems not limited by the number of max uncommitted message.


Hence my question about Java environment.

kun.leeing wrote:
The code to some extent is same as the jms code.


Some extent? What extend? How much the same? Does it have explicit disconnects? Is it 90% the same? 80% the same? Mostly the same? Have some lines in common?

This is not a very informative comment. My car is much the same as your car, given that it has an engine, 4 wheels and is driven by moving a big wheel. Though yours is probably much nicer, and driven much better.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Apr 29, 2009 1:19 am    Post subject: Re: max uncommitted message limit... Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

kun.leeing wrote:
And there's no reason code returned,

JMSException.getLinkedException() (or Throwable.getCause())may return additional exception(s) with more detailed information.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Apr 29, 2009 1:40 am    Post subject: Re: max uncommitted message limit... Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

rekarm01 wrote:
kun.leeing wrote:
And there's no reason code returned,

JMSException.getLinkedException() (or Throwable.getCause())may return additional exception(s) with more detailed information.


Oh good - I didn't think my Java was that bad.....
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Apr 29, 2009 2:57 am    Post subject: Reply with quote

Grand High Poobah

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

Quote:
this.session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);

This is where you defined your subscriber to be transacted.
After receiving x messages have your subscriber issue this.session.commit();

This should fix your issue.

You are using the MDB MessageListener pattern outside of a J2EE appserver.
You need to pass the session to the MessageListener in the creation of the listener and at the end of the onMessage methode call the session's commit method. This is normally handled in the J2EE container that you don't have here...


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
kun.leeing
PostPosted: Wed Apr 29, 2009 7:02 pm    Post subject: Reply with quote

Disciple

Joined: 27 Sep 2008
Posts: 171

Thanks for all of responses above.



It's my false not to study apis thoroughly and inspect code carefully.

And saper, you help me again, thanks.
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 » max uncommitted message limit...
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.