[rabbitmq-discuss] rabbitmq erlang amqp_client question.

Simon MacMullen simon at rabbitmq.com
Mon Jun 2 10:48:55 BST 2014

On 30/05/2014 5:34AM, ale wrote:
> Hi,
> I’m implementing a basic consumer in erlang using the
> amqp_gen_consumer behavior from the official amqp_client.

Is there a reason you're implementing amqp_gen_consumer yourself? 
Normally you would use amqp_selective_consumer or amqp_direct_consumer 
rather than implementing your own.

If you do want your own consumer implementation, you need to configure 
it by opening the channel with amqp_connection:open_channel/2 not /1:

{ok, Channel} = amqp_connection:open_channel(
                     Connection, {my_consumer_module, ConsumerArgs})

> All that is working fine but hen I publish messages to the queue I
> would expect to receive messages via the [handle_deliver] callback
> but instead I’m receiving messages trough [handle_info].

That's the default amqp_direct_consumer behaviour you're seeing.

Cheers, Simon

Simon MacMullen
RabbitMQ, Pivotal

More information about the rabbitmq-discuss mailing list