I,m not completely sure, if I understood Stomp's ACK mode fully. To my understanding during SUBSCRIBE I send an "ack: client" header and later vor every MESSAGE frame I reply with an ACK frame containing the message-id taken from the MESSAGE frame.
Unfortunately using ActiveMQ 4.1.1 I get errors with this strategy. Below is a network dump (newlines inserted for readibility). Obviously ActiveMQ is not happy with the way I send the ACK. Is this a error in my usage of the protocol or is this a bug in ActiveMQ?
Regards
Maximillian Dornseif
>>> 'CONNECT\n\n\x00\n'
<<< 'CONNECTED\nsession:ID:lichtblick.local-51962-1186982857796-3:10\n\n\x00\n'
>>> 'SUBSCRIBE\n
destination: /topic/TEST\n
ack: client\n
activemq.prefetchSize: 1\n
activemq.dispatchAsync: true\n
id: sub-70c868-1186983021.846979.topic.TEST\n\n\x00\n'
[ ... 260 messages are send to the topic by another connection ...]
<<< 'MESSAGE\n
destination:/topic/TEST\nreceipt:rcpt#pyStompID-70b860-1186983021.851018-1ecc13cb\n
subscription:sub-70c868-1186983021.846979.topic.TEST\n
timestamp:1186983021851\n
priority:5\n
expires:0\n
message-id:pyStompID-70b860-1186983021.851018-1ecc13cb\n\n
0\x00\n'
>>> 'ACK\n
message-id:pyStompID-70b860-1186983021.851018-1ecc13cb\n\n\x00\n'
<<< 'ERROR\n
message:Unexpected ACK received for message-id [pyStompID-70b860-1186983021.851018-1ecc13cb]\n\n
org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK received for
message-id [pyStompID-70b860-1186983021.851018-1ecc13cb]\n
\tat org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:242)\n
\tat org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommad(ProtocolConverter.java:141)\n
\tat org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:71)\n
\tat org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:84)\n
\tat org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:137)\n
\tat java.lang.Thread.run(Thread.java:613)\n\x00\n'
Addition: I have observed this with activemq-4.1.1, activemq-4.2-20070607.230602-81 and activemq-5.0-20070812.222711-51.