[rabbitmq-discuss] Internal services (was Re: Queue info)

Tony Garnock-Jones tonyg at lshift.net
Wed Jul 16 10:44:18 BST 2008


Hi Michael,

Michael Arnoldus wrote:
> Speaking of which - if it should happen that I one late night are 
> finding myself sorely missing working in erlang to the degree that I'd 
> like to experiment with this - do you have any docs or just pointers to 
> how to receive and send AMQP from inside erlang? I guess using the 
> erlang AMQP client to let the server talk to itself isn't exactly the 
> right approach ...

Take a look at rabbit_error_logger.erl. This code relays all SASL (and 
other) log messages into a special topic exchange, "amq.rabbitmq.log", 
which can be bound to. (This isn't officially documented, yet.)

It declares the exchange and publishes to it:

     #exchange{} = rabbit_exchange:declare(
                     #resource{virtual_host = DefaultVHost,
                               kind = realm,
                               name = <<"/admin">>},
                     ?LOG_EXCH_NAME,
                     topic, true, false, []),
     ...
     {ok, _QueueNames} = rabbit_exchange:simple_publish(
                           false, false, LogExch, RoutingKey,
                           <<"text/plain">>,
                           list_to_binary(io_lib:format(Format, Data))),

Receiving is a bit more complex; take a look at 
rabbit_amqqueue:pseudo_queue/3.

Regards,
   Tony





More information about the rabbitmq-discuss mailing list