[rabbitmq-discuss] AMQP Field Tables & Short Integers

Gavin M. Roy gavinmroy at gmail.com
Fri Jan 17 00:57:19 GMT 2014


Hi all,

I ran into a small bug in pamqp where it tries to determine the best data type for an AMQP field table when packing data. I found that when I allow it to use a short int value, RabbitMQ can not properly decode it. I just went back and looked at the AMQP errata for field types at http://www.rabbitmq.com/amqp-0-9-1-errata.html#section_3. Seems my mistake was using the AMQP-0-9-1 standard for field types with regard to short integers.

According to that table for 0-9-1, U should indicate a signed 16-bit integer value and s should indicate a short string. These are the values I used, however RabbitMQ chokes on the U.

In looking at the code for the encoder and decoder in Rabbit, I see that s is used for short ints.

https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_binary_generator.erl#L133
https://github.com/rabbitmq/rabbitmq-server/blob/master/src/rabbit_binary_parser.erl#L78

And that the AMQP-0-9-1 specified U is not supported at all. Additionally, the 0-9-1 s is only used for short ints. This is mentioned in the remarks.

Will RabbitMQ be staying with the misuse of s for shorts for the foreseeable future? Is there any intention or desire to add the specified U into the decoder and never support s for anything but short-int instead of short-string?

Regards,

Gavin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140116/50190aa9/attachment.html>


More information about the rabbitmq-discuss mailing list