You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rasitha <ra...@gmail.com> on 2011/06/01 17:59:21 UTC
Apache.NMS.ActiveMQ.MessageConsumer bug
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.
Re: Apache.NMS.ActiveMQ.MessageConsumer bug
Posted by Timothy Bish <ta...@gmail.com>.
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/