[rabbitmq-discuss] erlang 1.6.0 client possible problem

Matthew Sackman matthew at lshift.net
Thu Apr 22 17:58:50 BST 2010


Hi Mark,

Needless to say, 1.6.0 is pretty ancient and we'd recommend that you
upgrade to the latest 1.7.2, where lib_amqp has vanished, and the
problem you're reporting has been abstracted away by the library.

On Thu, Apr 22, 2010 at 10:36:07AM -0600, Mark Geib wrote:
> case lib_amqp:get(Channel, Queue, false) of
>   basic.get_emtpy ->
>      ...
> 
>   {DeliveryTag, Content} ->
>      #content{payload_fragments_rev = Payload, class_id = ClassId,
> properties_bin = Props} = Content,
>      Message = list_to_binary(Payload),

The clue is in the name ;) payload_fragments_rev is a *reversed* list of
fragments. Thus you'll need to reverse it first. The reason this only
affects you with large messages is that smaller messages will be under
the max frame size, and thus will only be a single fragment.

Just ftr, if you do upgrade to 1.7.2, the API is now:

    {#'basic.get_ok'{}, #amqp_msg{payload = Payload}}
        = amqp_channel:call(Channel, #'basic.get'{queue = Q, no_ack = false}),

There, Payload is a single binary, not reversed, and not a list, thus
all the work has been done for you.

Best wishes,

Matthew




More information about the rabbitmq-discuss mailing list