[rabbitmq-discuss] Topic exchange erlang client

Andrey Kolchanov kolchanov at gmail.com
Tue Aug 28 12:55:07 BST 2012



I found error myself.

amqp_channel:call(Channel, #'basic.publish'{*exchange= ExchangeName*,routing_key 
= Key}, #amqp_msg{props = #'P_basic'{delivery_mode=2}, payload = Msg})

Thanks,
On Tuesday, August 28, 2012 2:57:40 PM UTC+4, Andrey Kolchanov wrote:
>
> Hello,
> I have a topic exchange in my test environment.
> I've add some binding to this exchange in web management console.When I 
> publish a test message with proper routing key via web management console 
> this message successfully delivered to desired queue.
> I'm trying to publish message through erlang client, but message is not 
> delivering to queue. 
> What is wrong with my code:
>
> ExchangeName = <<"custom.topic">>,   
> ExchangeType = <<"topic">>,  
> Key = <<"K">>,
> Msg = <<"123">>,
> {ok, Connection} = amqp_connection:start
>     (#amqp_params_network{username = <<"guest">>, password = <<"guest">>, host = "192.168.1.1"}),
> {ok, Channel} = amqp_connection:open_channel(Connection),
> #'exchange.declare_ok'{} = 
>     amqp_channel:call(Channel, #'exchange.declare'{exchange=ExchangeName, durable=true, type = ExchangeType}), 
>
> ok = amqp_channel:call(Channel, #'basic.publish'{routing_key = Key}, 
> #amqp_msg{props = #'P_basic'{delivery_mode=2}, payload = Msg}) .
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120828/54f8ef28/attachment.htm>


More information about the rabbitmq-discuss mailing list