Author |
Message
|
kun.leeing |
Posted: Mon Apr 27, 2009 6:36 pm Post subject: max uncommitted message limit... |
|
|
 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 |
|
 |
Vitor |
Posted: Mon Apr 27, 2009 11:51 pm Post subject: Re: max uncommitted message limit... |
|
|
 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 |
|
 |
kun.leeing |
Posted: Tue Apr 28, 2009 10:36 pm Post subject: |
|
|
 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 |
|
 |
kun.leeing |
Posted: Tue Apr 28, 2009 10:41 pm Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Tue Apr 28, 2009 11:39 pm Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Tue Apr 28, 2009 11:43 pm Post subject: |
|
|
 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 |
|
 |
rekarm01 |
Posted: Wed Apr 29, 2009 1:19 am Post subject: Re: max uncommitted message limit... |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 29, 2009 1:40 am Post subject: Re: max uncommitted message limit... |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Oh good - I didn't think my Java was that bad..... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Apr 29, 2009 2:57 am Post subject: |
|
|
 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 |
|
 |
kun.leeing |
Posted: Wed Apr 29, 2009 7:02 pm Post subject: |
|
|
 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 |
|
 |
|