stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

Connection#ack, stomp 1.2, erroneously sets 'id' header #124

Closed gmallard closed 8 years ago

gmallard commented 8 years ago

Current code for Connection ack with protocol level 1.2 is:

headers[:id] = message_id

This is incorrect. It does not match the 1.2 specification. Furthermore, results (with AMQ) are similar to:

2016-07-03 21:17:32,329 [MQ NIO Worker 1] TRACE LegacyFrameTranslator          -
 New Composite Destination name: queue://srtest.1
2016-07-03 21:17:32,355 [0:0:0:0:1:35628] TRACE StompIO                        -
 Sending: 
MESSAGE
content-length:17
expires:0
destination:/queue/srtest.1
ack:ID:tjjackson-39052-1467595042897-5:1
subscription:srtest1.subid
priority:4
message-id:ID:tjjackson-39052-1467595042897-3:1:-1:1:1
content-type:text/plain; charset=UTF-8
timestamp:1467595051319

Message Number: 1^@
2016-07-03 21:17:32,583 [MQ NIO Worker 1] TRACE StompIO                        -
 Received: 
ACK
content-length:0
subscription:srtest1.subid
content-type:text/plain; charset=UTF-8
id:ID:tjjackson-39052-1467595042897-3:1:-1:1:1

^@
2016-07-03 21:17:32,584 [MQ NIO Worker 1] WARN  ProtocolConverter              - Exception occurred processing: 
ACK
content-length:0
subscription:srtest1.subid
content-type:text/plain; charset=UTF-8
id:ID:tjjackson-39052-1467595042897-3:1:-1:1:1

^@: org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK received for message-id [null]
2016-07-03 21:17:32,585 [MQ NIO Worker 1] DEBUG ProtocolConverter              - Exception detail
org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK received for message-id [null]
...
...
gmallard commented 8 years ago

This failure does not occur with client code like:

msg = @conn.receive
@conn.ack msg.headers['ack']

It does occur with client code like:

msg = @conn.receive
@conn.ack msg.headers['message-id']

This will be addressed through additional RDOC comments.

See ddc4d55 on the 'dev' branch.