[rabbitmq-discuss] problems updating to new client library

Max Warnock maxjwarnock at gmail.com
Thu Oct 13 18:17:40 BST 2011


I've just swapped out the whole amqp_client infrastructure in my erlang
application to the latest release. It looks like there were significant
changes to the infrastructure but the api remains almost identical (the
network vs direct connection being the only exception I've found).  But now
I'm getting an error in code that used to work about my subscription.  My
code looks like this:


%% Queue is a binary name, Listener is a PID and State is a dictionary
containing various things including the channel PID
subscribe(Queue,Listener,State) ->
    Sub = #'basic.consume'{queue = Queue},
    #'basic.consume_ok'{consumer_tag = Tag} =
amqp_channel:subscribe(State:fetch(amqp_channel_pid), Sub, Listener),
    {ok, Tag}.


This worked with the previous version of the library and I don't see any
difference in the docs (
http://www.rabbitmq.com/erlang-client-user-guide.html) now it produces the
following error:

 {{function_clause,
                      [{amqp_selective_consumer,handle_consume_ok,
                           [{'basic.consume_ok',
                                <<"amq.ctag-yC9CxaknYwPrAYj5hCChPQ==">>},

 {'basic.consume',0,<<"harbinger-dm-hipaa">>,<<>>,
                                false,false,false,false,[]},
                            {state,
                                {dict,0,16,16,8,80,48,
                                    {[],[],[],[],[],[],[],[],[],[],[],[],[],
                                     [],[],[]},

 {{[],[],[],[],[],[],[],[],[],[],[],[],[],
                                      [],[],[]}}},
                                hipaa,
                                {dict,0,16,16,8,80,48,
                                    {[],[],[],[],[],[],[],[],[],[],[],[],[],
                                     [],[],[]},

 {{[],[],[],[],[],[],[],[],[],[],[],[],[],
                                      [],[],[]}}},
                                none}]},
                       {amqp_gen_consumer,handle_call,3},
                       {gen_server2,handle_msg,2},
                       {proc_lib,init_p_do_apply,3}]},
                  {gen_server2,call,
                      [<0.181.0>,
                       {consumer_call,
                           {'basic.consume_ok',
                               <<"amq.ctag-yC9CxaknYwPrAYj5hCChPQ==">>},
                           {'basic.consume',0,<<"harbinger-dm-hipaa">>,<<>>,
                               false,false,false,false,[]}},
                       infinity]}}

There is a clause in the new docs that explains the difference between the
selective consumer and the direct consumer. Based on that description it
seems like everything used to be a direct consumer and that's what I should
be using, but I don't see any docs on how to use it. I explored the rabbit
headers and couldn't find anything that would let me select it. The only
mention of it I found was when selective consumer is set as the default.

Thanks,
-Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20111013/f2ec2be1/attachment.htm>


More information about the rabbitmq-discuss mailing list