activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rasitha <rasitha.wijesin...@gmail.com>
Subject Apache.NMS.ActiveMQ.MessageConsumer bug
Date Wed, 01 Jun 2011 15:59:21 GMT
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();
	}
}


--
View this message in context: http://activemq.2283324.n4.nabble.com/Apache-NMS-ActiveMQ-MessageConsumer-bug-tp3566206p3566206.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message