You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by liquidd <sp...@mail.ru> on 2009/04/13 13:15:18 UTC

Subscribe + Client aknowledge problem

I have a queue,
I have a producer that sends messages to it,
And I have a consumer that synchronously reads messages (by
MessageConsumer.receive()) and acknowledges it if message is correct (my own
validation), then going to listen next messages. If it is not correct, then
it doesn't call aknowledge.

Now my actions:
1. Sending 1 correct message.
2. Consumer successfully reads 1 message and 1 times acknowledges.
3. Sending 1 incorrect messages.
4. Consumer doesn't aknowledge them and continuing listen for other message.
(ActiveMQ keeps incorrect message).
And here problem:
5. Sending 1 correct message.
6. Consumer successfully reads 1 message and 1 times acknowledges.
7. Incorrect message DISSAPEARED from ActiveMQ!

WHY? =)

Thanks.
-- 
View this message in context: http://www.nabble.com/Subscribe-%2B-Client-aknowledge-problem-tp23020938p23020938.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Subscribe + Client aknowledge problem

Posted by liquidd <sp...@mail.ru>.
I found it!!

ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE

Doctor, you are genious!

Thanks!
-- 
View this message in context: http://www.nabble.com/Subscribe-%2B-Client-aknowledge-problem-tp23020938p23021595.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Subscribe + Client aknowledge problem

Posted by liquidd <sp...@mail.ru>.
Ok, here what I read about receive();

"The standard behavior of this method is to cause the session to acknowledge
all messages that have been consumed by any consumer in the session since
the last time the method was invoked."

So how can I aknowledge only one message? Does using com.sun.messaging.jms
(which has such method) is correct with ActiveMQ?
-- 
View this message in context: http://www.nabble.com/Subscribe-%2B-Client-aknowledge-problem-tp23020938p23021429.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Subscribe + Client aknowledge problem

Posted by liquidd <sp...@mail.ru>.
My code:
QueueConnection s_queueConnection =
s_connectionFactory.createQueueConnection();

Session m_queueSessionConsume = s_queueConnection.createQueueSession(false,
Session.CLIENT_ACKNOWLEDGE);
Queue m_queue = m_queueSessionConsume.createQueue("MyQueue");

m_queueReceiver = m_queueSessionConsume.createConsumer(m_queue);

s_queueConnection.start();

...

m_currMsg = m_queueReceiver.receive();

-- 
View this message in context: http://www.nabble.com/Subscribe-%2B-Client-aknowledge-problem-tp23020938p23021110.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Subscribe + Client aknowledge problem

Posted by dlindquist <ju...@dlindquist.com>.

liquidd wrote:
> 
> 3. Sending 1 incorrect messages.
> 4. Consumer doesn't aknowledge them and continuing listen for other
> message. (ActiveMQ keeps incorrect message).
> And here problem:
> 5. Sending 1 correct message.
> 6. Consumer successfully reads 1 message and 1 times acknowledges.
> 7. Incorrect message DISSAPEARED from ActiveMQ!
> ...
> 

Hi,

I may be wrong, but as I understand it, the mechanics of message
acknowledgement mean that when you acknowledge ANY message, you acknowledge
ALL prior messages.

I believe that there is a feature called a 'dead letter' queue that you can
use to manage these types of things (do a quick google on something like
'ActiveMQ acknowledge dead-letter').  This is just what I recall from my
browsing of some JMS documentation, so perhaps someone more knowledgeable
can fill us both in ;-)

-- 
View this message in context: http://www.nabble.com/Subscribe-%2B-Client-aknowledge-problem-tp23020938p23268490.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.