Re-delivery of messages or call of onMessage method again and again - Weblogic
This is a discussion on Re-delivery of messages or call of onMessage method again and again - Weblogic ; Hi,
We are using MDB and message is sent to the topic using a servlet. In the servlet,
the code written is as below (part of it)-
// Lookup for Connection Factory
topicConnectionFactory = ( TopicConnectionFactory )
initialContext.lookup(
jndiFactory ) ...
-
Re-delivery of messages or call of onMessage method again and again
Hi,
We are using MDB and message is sent to the topic using a servlet. In the servlet,
the code written is as below (part of it)-
// Lookup for Connection Factory
topicConnectionFactory = ( TopicConnectionFactory )
initialContext.lookup(
jndiFactory ) ;
// Create Connection from factory
topicConnection = topicConnectionFactory.
createTopicConnection( ) ;
// Create Session from Connection
topicSession = topicConnection.createTopicSession( false,
Session.AUTO_ACKNOWLEDGE ) ;
// Lookup for Destination Topic
topic = ( Topic ) initialContext.lookup( topicToPublish ) ;
// Create Message Sender for sending message from Session
topicPublisher = topicSession.createPublisher( topic ) ;
// Create Message object to be sent
textMessage = topicSession.createTextMessage( ) ;
// Start Connection
topicConnection.start( ) ;
// Set Message object to be sent
textMessage.setText( message ) ;
// Send message using Topic Sender
topicPublisher.publish( textMessage ) ;
request.setAttribute( "reloadStatus", "SUCCESS") ;
In the onMessage (), we are doing some database operation (some select statements).
The whole call is going in loop. What could be the reason?
So, is it happening due to -
1. topicSession = topicConnection.createTopicSession( false,
Session.AUTO_ACKNOWLEDGE ) ;
Can "Session.AUTO_ACKNOWLEDGE" cause the redeilivery to happen, if any exception
occurs?
2. What's the behavior of the MDB in case of any exception? Becasue in logs, we
are getting following exception -
weblogic.transaction.RollbackException: Transaction has timed out when making
request to XAResource 'JMS_WSIJMSServer_NotDurable'. - with nested exception:
[weblogic.transaction.internal.TimedOutException: Transaction has timed out when
making request to XAResource 'JMS_WSIJMSServer_NotDurable'.]
Problem is - In case of any exception, why will this looping happens?
Please respond to my personal id as well. My id is - avkumar@dhl.com
Thanks in advance.
Regards,
Avinash
-
Re: Re-delivery of messages or call of onMessage method again and again
For some reason, the transactions from your MDB are timing out.
This usually happens when the MDB takes longer than the
transaction timeout to process a message. The default
timeout is 30 seconds. I think you need to instrument
your MDB code to
(A) determine how long it is taking to process the message
(B) determine if the MDB is "locking up"
(C) determine if the MDB is throwing exceptions
(try catch (Throwable) System.out)
You can configure a custom tx timeout in your ejb
descriptor, or increase the server-wide default.
"Avinash" wrote:
>
>Hi,
>
>We are using MDB and message is sent to the topic using a servlet. In
>the servlet,
>the code written is as below (part of it)-
>
> // Lookup for Connection Factory
> topicConnectionFactory = ( TopicConnectionFactory )
> initialContext.lookup(
> jndiFactory ) ;
>
> // Create Connection from factory
> topicConnection = topicConnectionFactory.
> createTopicConnection( ) ;
>
> // Create Session from Connection
> topicSession = topicConnection.createTopicSession( false,
> Session.AUTO_ACKNOWLEDGE
>) ;
>
> // Lookup for Destination Topic
> topic = ( Topic ) initialContext.lookup( topicToPublish
>) ;
>
> // Create Message Sender for sending message from Session
> topicPublisher = topicSession.createPublisher( topic
>) ;
>
> // Create Message object to be sent
> textMessage = topicSession.createTextMessage( ) ;
>
> // Start Connection
> topicConnection.start( ) ;
>
> // Set Message object to be sent
> textMessage.setText( message ) ;
>
> // Send message using Topic Sender
> topicPublisher.publish( textMessage ) ;
> request.setAttribute( "reloadStatus", "SUCCESS") ;
>
>In the onMessage (), we are doing some database operation (some select
>statements).
>The whole call is going in loop. What could be the reason?
>
>So, is it happening due to -
>
>1. topicSession = topicConnection.createTopicSession(
>false,
> Session.AUTO_ACKNOWLEDGE
>) ;
> Can "Session.AUTO_ACKNOWLEDGE" cause the redeilivery to happen, if any
>exception
>occurs?
>
>2. What's the behavior of the MDB in case of any exception? Becasue in
>logs, we
>are getting following exception -
>
>weblogic.transaction.RollbackException: Transaction has timed out when
>making
>request to XAResource 'JMS_WSIJMSServer_NotDurable'. - with nested exception:
>[weblogic.transaction.internal.TimedOutException: Transaction has timed
>out when
>making request to XAResource 'JMS_WSIJMSServer_NotDurable'.]
>
>Problem is - In case of any exception, why will this looping happens?
>
>Please respond to my personal id as well. My id is - avkumar@dhl.com
>
>Thanks in advance.
>
>Regards,
>Avinash
-
Re: Re-delivery of messages or call of onMessage method again and again
What I guess is that the database operation within your onMessage() routine taking
longer than the transaction timeout set forth, causing the transaction to rollback,
the
message bounces back to the MDB's onMessage(), thus looping..
"Avinash" wrote:
>
>Hi,
>
>We are using MDB and message is sent to the topic using a servlet. In
>the servlet,
>the code written is as below (part of it)-
>
> // Lookup for Connection Factory
> topicConnectionFactory = ( TopicConnectionFactory )
> initialContext.lookup(
> jndiFactory ) ;
>
> // Create Connection from factory
> topicConnection = topicConnectionFactory.
> createTopicConnection( ) ;
>
> // Create Session from Connection
> topicSession = topicConnection.createTopicSession( false,
> Session.AUTO_ACKNOWLEDGE
>) ;
>
> // Lookup for Destination Topic
> topic = ( Topic ) initialContext.lookup( topicToPublish
>) ;
>
> // Create Message Sender for sending message from Session
> topicPublisher = topicSession.createPublisher( topic
>) ;
>
> // Create Message object to be sent
> textMessage = topicSession.createTextMessage( ) ;
>
> // Start Connection
> topicConnection.start( ) ;
>
> // Set Message object to be sent
> textMessage.setText( message ) ;
>
> // Send message using Topic Sender
> topicPublisher.publish( textMessage ) ;
> request.setAttribute( "reloadStatus", "SUCCESS") ;
>
>In the onMessage (), we are doing some database operation (some select
>statements).
>The whole call is going in loop. What could be the reason?
>
>So, is it happening due to -
>
>1. topicSession = topicConnection.createTopicSession(
>false,
> Session.AUTO_ACKNOWLEDGE
>) ;
> Can "Session.AUTO_ACKNOWLEDGE" cause the redeilivery to happen, if any
>exception
>occurs?
>
>2. What's the behavior of the MDB in case of any exception? Becasue in
>logs, we
>are getting following exception -
>
>weblogic.transaction.RollbackException: Transaction has timed out when
>making
>request to XAResource 'JMS_WSIJMSServer_NotDurable'. - with nested exception:
>[weblogic.transaction.internal.TimedOutException: Transaction has timed
>out when
>making request to XAResource 'JMS_WSIJMSServer_NotDurable'.]
>
>Problem is - In case of any exception, why will this looping happens?
>
>Please respond to my personal id as well. My id is - avkumar@dhl.com
>
>Thanks in advance.
>
>Regards,
>Avinash