activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre vd Merwe <andre...@p-cubed.co.za>
Subject RE: Unmatched acknowledge
Date Sun, 21 Nov 2010 05:37:19 GMT
Hi,

For anyone else having this problem;

I originally circumvented the issue by using the event based interface.

However I have found the correct way of pulling a message on demand from multiple threads.
Simply use the INDIVIDUAL_ACKNOWLEDGE acknowledge mode.

From: http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQSession.html#INDIVIDUAL_ACKNOWLEDGE

INDIVIDUAL_ACKNOWLEDGE: Only acknowledge an individual message - using message.acknowledge()
as opposed to CLIENT_ACKNOWLEDGE which acknowledges all messages consumed by a session at
when acknowledge() is called


I wish I had seen this before...


Hope this helps someone

Andre

-------------------
From: Andre vd Merwe [mailto:andrevdm@p-cubed.co.za]
Sent: 05 October 2010 09:46
To: users@activemq.apache.org
Subject: Unmatched acknowledge

Hi,

I am getting an "Unmatched acknowledge" exception, with a message like this "Expected message
count (5) differs from count in dispatched-list (4)"  (Full exception at the end of this mail).

All I can find when I search is are following and they are both old and indicate that issue
was resolved a while back.
        https://issues.apache.org/activemq/browse/AMQ-2489
        http://activemq.2283324.n4.nabble.com/Could-not-correlate-acknowledgment-with-dispatched-message-td2367336.html#a2367336

What happens is that I queue 200 message (non-persistent) and then dequeue them in multiple
threads. Even though I get all 200 messages back ActiveMQ says that there are pending messages
(usually around 7). When I restart the client these pending messages are then re-delivered.
This is obviously a problem.

What I found is that this only occurs if I poll for messages in multiple threads. If I used
the event based notification there is never an issue, I assume because this is done in a single
thread.

So although I have this working and it is cleaner I am still confused (and concerned) as to
why I would get this error.

Has anyone else had this problem? Why is this marked as a warning and not an error?


Thanks for any assistance

Andre.




-------------
Version info
-------------
ActiveMQ 5.4.1 on windows 7
C# 4.0 client using NMS.
JDK: jdk1.6.0_06


-------------
Exception
-------------

2010-10-04 15:55:26,108 | WARN  | Async error occurred: javax.jms.JMSException: Unmatched
acknowledge: MessageAck {commandId = 243, responseRequired = false, ackType = 2, ..., messageCount
= 5}; Expected message count (5) differs from count in dispatched-list (4) | org.apache.activemq.broker.TransportConnection.Service
| ActiveMQ Transport: tcp:///0:0:0:0:0:0:0:1:52269
javax.jms.JMSException: Unmatched acknowledge: MessageAck {commandId = 243, responseRequired
= false, ackType = 2, ..., transactionId = null, messageCount = 5}; Expected message count
(5) differs from count in dispatched-list (4)
        at org.apache.activemq.broker.region.PrefetchSubscription.assertAckMatchesDispatched(PrefetchSubscription.java:444)
        at org.apache.activemq.broker.region.PrefetchSubscription.acknowledge(PrefetchSubscription.java:207)
        at org.apache.activemq.broker.region.AbstractRegion.acknowledge(AbstractRegion.java:383)
        at org.apache.activemq.broker.region.RegionBroker.acknowledge(RegionBroker.java:543)
        at org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:77)
        at org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:77)
        at org.apache.activemq.broker.BrokerFilter.acknowledge(BrokerFilter.java:77)
        at org.apache.activemq.broker.TransactionBroker.acknowledge(TransactionBroker.java:200)
        at org.apache.activemq.broker.MutableBrokerFilter.acknowledge(MutableBrokerFilter.java:87)
        at org.apache.activemq.broker.TransportConnection.processMessageAck(TransportConnection.java:467)
        at org.apache.activemq.command.MessageAck.visit(MessageAck.java:205)
        at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:309)
        at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:185)
        at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
        at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
        at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:228)
        at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
        at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:219)
        at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:201)
        at java.lang.Thread.run(Thread.java:619)



Information contained in this e-mail, including attachments and any rights hereto are the
property of Portfolio Prospecting and Performance (Pty) Ltd (unless the context clearly indicates
otherwise). It is confidential, private and intended for the addressee only and should you
not be the addressee and receive it by mistake, kindly notify the sender and delete this information
immediately without further disclosure to any other party. Save for bona fide views of Portfolio
Prospecting and Performance (Pty) Ltd, views and opinions expressed in this e-mail are those
of the sender only. Portfolio Prospecting and Performance (Pty) Ltd accepts no liability whatsoever
for any loss or damages incurred, or suffered, arising from the use the information in this
e-mail. Portfolio Prospecting and Performance (Pty) Ltd does not warrant the integrity of
this e-mail nor that it is free of errors, viruses, interception or interference

________________________________________
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1153 / Virus Database: 424/3268 - Release Date: 11/20/10

Information contained in this e-mail, including attachments and any rights hereto are the
property of Portfolio Prospecting and Performance (Pty) Ltd (unless the context clearly indicates
otherwise). It is confidential, private and intended for the addressee only and should you
not be the addressee and receive it by mistake, kindly notify the sender and delete this information
immediately without further disclosure to any other party. Save for bona fide views of Portfolio
Prospecting and Performance (Pty) Ltd, views and opinions expressed in this e-mail are those
of the sender only. Portfolio Prospecting and Performance (Pty) Ltd accepts no liability whatsoever
for any loss or damages incurred, or suffered, arising from the use the information in this
e-mail. Portfolio Prospecting and Performance (Pty) Ltd does not warrant the integrity of
this e-mail nor that it is free of errors, viruses, interception or interference


Mime
View raw message