[rabbitmq-discuss] problems updating to new client library

Simon MacMullen simon at rabbitmq.com
Fri Oct 14 11:25:55 BST 2011


Hi Max.

On 13/10/11 18:17, Max Warnock wrote:
> 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)

It should work the same.

> now it produces the following error:
>
>   {{function_clause,
<snip>

So it looks like amqp_selective_consumer is getting into a state where 
it thinks your consumer (which should be a pid) is the atom 'hipaa'. 
This is just what gets passed in to the third argument of 
amqp_channel:subscribe/3. Unfortunately nothing enforces this until we 
get a consume_ok back from the server. Are you sure you are passing in a 
pid there?

> 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,

No, it used to be a selective consumer and that's what I should be using 
(if you don't want to change anything). Selective is the default.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list