You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by jonm <jo...@workingtoday.org> on 2007/04/02 22:35:48 UTC

STOMP broker - order of ACKs?

I am new to JMS and ActiveMQ -- I have been investigating using the STOMP
broker and things have worked well so far, but I have a question about ACKs
to messages received by a consumer:

It seems that the order of ACKs is not important (if they are done in a
'batch'), for example, I can receive, say 10 messages, process them and then
ACK all of them. I can even scramble the order of ACKs after the messages
have been processed and it's OK.

However, say I write a forked script that processes messages as needed (some
children take longer depending on the action required by the message) and
the children do their own ACKing... Seems like this is not allowed and that
this sequence of events cannot happen on the connection:

- Message 1 rcvd
- ACK msg 1
- Message 2 rcvd
- Message 3 rcvd
- ACK msg 3
- ACK msg 2

I seem to get the following error (a STOMP ERROR frame) in this scenario:

[message] => Unexpected ACK received for message-id
[ID:jstation-36270-1175286660410-3:148:-1:1:41]
[body]=>
org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK
received for message-id [ID:jstation-36270-1175286660410-3:148:-1:1:41]
at
org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:242)
at
org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:141)
at
org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:64)
at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
at java.lang.Thread.run(Thread.java:534)

Although this error is thrown, the message is no longer in the queue
(jconsole indicates no messages are waiting to be picked up/sent to the
consumer)...... so though the exception is thrown, everything seems OK....
is this expected? can I ignore this exception and still rely on this
message/ack sequence?

I'm using activeMQ version 4.1.0

thanks,
jon 
-- 
View this message in context: http://www.nabble.com/STOMP-broker---order-of-ACKs--tf3508100s2354.html#a9798481
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: STOMP broker - order of ACKs?

Posted by jonm <jo...@workingtoday.org>.
Just a clarification in the sequence that doesn't work:

- Message 1 rcvd
- ACK msg 1
- Message 2 rcvd
- Message 3 rcvd
- ACK msg 3
- ACK msg 2

the ACK of messages 1 and 3 are OK... it is the ACK of msg 2 that throws the
exception........

jon




jonm wrote:
> 
> I am new to JMS and ActiveMQ -- I have been investigating using the STOMP
> broker and things have worked well so far, but I have a question about
> ACKs to messages received by a consumer:
> 
> It seems that the order of ACKs is not important (if they are done in a
> 'batch'), for example, I can receive, say 10 messages, process them and
> then ACK all of them. I can even scramble the order of ACKs after the
> messages have been processed and it's OK.
> 
> However, say I write a forked script that processes messages as needed
> (some children take longer depending on the action required by the
> message) and the children do their own ACKing... Seems like this is not
> allowed and that this sequence of events cannot happen on the connection:
> 
> - Message 1 rcvd
> - ACK msg 1
> - Message 2 rcvd
> - Message 3 rcvd
> - ACK msg 3
> - ACK msg 2
> 
> I seem to get the following error (a STOMP ERROR frame) in this scenario:
> 
> [message] => Unexpected ACK received for message-id
> [ID:jstation-36270-1175286660410-3:148:-1:1:41]
> [body]=>
> org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK
> received for message-id [ID:jstation-36270-1175286660410-3:148:-1:1:41]
> at
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:242)
> at
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:141)
> at
> org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:64)
> at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
> at java.lang.Thread.run(Thread.java:534)
> 
> Although this error is thrown, the message is no longer in the queue
> (jconsole indicates no messages are waiting to be picked up/sent to the
> consumer)...... so though the exception is thrown, everything seems OK....
> is this expected? can I ignore this exception and still rely on this
> message/ack sequence?
> 
> I'm using activeMQ version 4.1.0
> 
> thanks,
> jon 
> 

-- 
View this message in context: http://www.nabble.com/STOMP-broker---order-of-ACKs--tf3508100s2354.html#a9799197
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: STOMP broker - order of ACKs?

Posted by James Strachan <ja...@gmail.com>.
BTW some bugs were fixed in 4.1.1 to do with out of order ACK support.

But if you really want to have child processes/threads perform
independent work which will lead to messages being processed out of
order from which they are received, I'd recommed using multiple
subscriptions; one per thread/process; then each consumer can ack its
own messages which will not affect the other subscribers.


On 4/2/07, jonm <jo...@workingtoday.org> wrote:
>
> I am new to JMS and ActiveMQ -- I have been investigating using the STOMP
> broker and things have worked well so far, but I have a question about ACKs
> to messages received by a consumer:
>
> It seems that the order of ACKs is not important (if they are done in a
> 'batch'), for example, I can receive, say 10 messages, process them and then
> ACK all of them. I can even scramble the order of ACKs after the messages
> have been processed and it's OK.
>
> However, say I write a forked script that processes messages as needed (some
> children take longer depending on the action required by the message) and
> the children do their own ACKing... Seems like this is not allowed and that
> this sequence of events cannot happen on the connection:
>
> - Message 1 rcvd
> - ACK msg 1
> - Message 2 rcvd
> - Message 3 rcvd
> - ACK msg 3
> - ACK msg 2
>
> I seem to get the following error (a STOMP ERROR frame) in this scenario:
>
> [message] => Unexpected ACK received for message-id
> [ID:jstation-36270-1175286660410-3:148:-1:1:41]
> [body]=>
> org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK
> received for message-id [ID:jstation-36270-1175286660410-3:148:-1:1:41]
> at
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:242)
> at
> org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:141)
> at
> org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:64)
> at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)
> at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)
> at java.lang.Thread.run(Thread.java:534)
>
> Although this error is thrown, the message is no longer in the queue
> (jconsole indicates no messages are waiting to be picked up/sent to the
> consumer)...... so though the exception is thrown, everything seems OK....
> is this expected? can I ignore this exception and still rely on this
> message/ack sequence?
>
> I'm using activeMQ version 4.1.0
>
> thanks,
> jon
> --
> View this message in context: http://www.nabble.com/STOMP-broker---order-of-ACKs--tf3508100s2354.html#a9798481
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/