[rabbitmq-discuss] rabbitmq erlang amqp_client question.

ale alexelement01 at gmail.com
Mon Jun 2 23:45:51 BST 2014


Hi Simon,

I’m new to erlang (1 week) and wasn’t sure what I was doing, I grabbed the amqp_gen_consumer because I wanted to learn and understand how it works under the hood.
I figured out how the amqp_gen_consumer works.   (Was a great learning experience.).

Now that I’m done with that I’m glad that you mentioned about the amqp_selective_consumer and amqp_direct_consumer.
Can you point me to doc or code example that describes how to implement amqp_selective_consumer or amqp_direct_consumer inside an OTP application?

Thanks!
A

On Jun 2, 2014, at 2:48 AM, Simon MacMullen <simon at rabbitmq.com> wrote:

> 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