Hi All,
Need to have some clarification on the JMS acknowledge-mode and transactions.
In my application I have a MDB (has conatainer managed transaction )which publishes to a topic ( say TOPIC-A ).
Here is the code i am using to publish:
connection = factory.createTopicConnection();
session = ( TopicSession ) connection.createTopicSession( true, Session.AUTO_ACKNOWLEDGE );
publisher = session.createPublisher( topic );
message = session.createTextMessage();
message.setText( requestXML );
session.commit();
connection.close();
There are 2 subscribers of this topic:
1) MDB (which also has container managed transaction )
it uses following code to publish message to supplier destination queue
_connection = _factory.createQueueConnection();
session = (QueueSession) _connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
sender = session.createSender( _queue );
message = session.createTextMessage();
message.setText(messageRecd);
sender.send(message);
String messageID = message.getJMSMessageID().substring(3);
session.commit();
_connection.close();
2) JMS Subscriber uses the following code to receive the message:
_tConnection = _topicConFactory.createTopicConnection();
TopicSession tSession = _tConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicSubscriber tSubscriber = tSession.createDurableSubscriber( _topic,"gatewaySubscriber" );
tSubscriber.setMessageListener( msgLsnr );
I am using weblogic 8.1. When I look in weblogic console for the details for TOPIC-A, it increments the 'Message Pending' everytime I send a message, although i can see all the messages being consumed and none is lost. And as per BEA
Pending means the message could have been:
* sent in a transaction but not committed.
* received and not acknowledged.
* received and not committed.
* subject to a redelivery delay (as of WebLogic JMS 6.1 or later).
* subject to a delivery time (as of WebLogic JMS 6.1 or later).
Well I don't think any of the above mentioned condition is happening in my case. Can anybody shed some light on why it is happening.
Thanks,
Nidhi