activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: Apache.NMS.ActiveMQ.MessageConsumer bug
Date Wed, 01 Jun 2011 17:47:07 GMT
On Wed, 2011-06-01 at 08:59 -0700, rasitha wrote:
> Hi,
> 
> Related to 
> http://activemq.2283324.n4.nabble.com/Dead-Letter-Queue-td2356685.html this
> post  I started looking into the differences between java and .net versions
> of the message consumer and I think there is an issue in the NMS version.
> 
> In the Java version, if an exception is thrown in the onMessage call a
> rollback will be issued. 
> 
>     } catch (RuntimeException e) {
> 	LOG.error(getConsumerId() + " Exception while processing message: " +
> md.getMessage().getMessageId(), e);
> 	if (isAutoAcknowledgeBatch() || isAutoAcknowledgeEach() ||
> session.isIndividualAcknowledge()) {
> 	    // schedual redelivery and possible dlq processing
> 	    md.setRollbackCause(e);
> 	    rollback();
> 	} else {
> 	    // Transacted or Client ack: Deliver the
> 	    // next message.
> 	    afterMessageIsConsumed(md, false);
> 	}
>     }
> 
> 
> 
> But in the NMS version, for Auto Ack and Individual, a rollback is not
> issued. So it never honors the MaximumRedeliveries value and no message will
> get to the DLQ.
> 
> catch(Exception e)
> {
> 	if(IsAutoAcknowledgeBatch || IsAutoAcknowledgeEach ||
> IsIndividualAcknowledge)
> 	{
> 		// Redeliver the message
> 	}
> 	else
> 	{
> 		// Transacted or Client ack: Deliver the next message.
> 		this.AfterMessageIsConsumed(dispatch, false);
> 	}
> 
> 	Tracer.Error(this.info.ConsumerId + " Exception while processing message: "
> + e);
> 
> 	// If aborted we stop the abort here and let normal processing resume.
> 	// This allows the session to shutdown normally and ack all messages
> 	// that have outstanding acks in this consumer.
> 	if( (Thread.CurrentThread.ThreadState & ThreadState.AbortRequested) ==
> ThreadState.AbortRequested)
> 	{
> 		Thread.ResetAbort();
> 	}
> }
> 

Best thing to do here is create a new Jira issue and attach a test case
that reproduces the problem so that the fix is validated during testing
in the future. 

Regards


-- 
Tim Bish
------------
FuseSource
Email: tim.bish@fusesource.com
Web: http://fusesource.com
Twitter: tabish121
Blog: http://timbish.blogspot.com/




Mime
View raw message