queue - RabbitMQ: How to send Dead Letter Exchange from Erlang client -
i want send dead letter exchange erlang client tried few days unable figure out how while can send through ruby client easily.
amqp_channel:call(channel, #'queue.declare'{ queue = queuename, arguments = [{<<"x-dead-letter-exchange">>, <<"">>}, {<<"x-dead-letter-routing-key">>, <<"task_pool1">>}, {<<"x-message-ttl">>, unhideinminute*60000}], durable = true} ), io:format("declared channel.~n"), amqp_channel:cast(channel, #'basic.publish'{ exchange = <<"">>, routing_key = queuename }, #amqp_msg{props = #'p_basic'{delivery_mode = 2}, payload = jsonmsg} )
thanks
the problem when set arguments.
here code:
%% start network connection {ok, connection} = amqp_connection:start(#amqp_params_network{}), erlang:display("connection established"), ex=#'exchange.declare'{exchange = <<"my_exchange">>, ticket = 0, type = <<"topic">>, passive = false, durable = false, auto_delete = false, internal = false, nowait = false, arguments = []}, {ok, channel} = amqp_connection:open_channel(connection), amqp_channel:call(channel, ex), erlang:display("exchange created"), amqp_channel:call(channel, #'queue.declare'{ queue = <<"myqueue12">>, arguments = [{<<"x-dead-letter-exchange">>,longstr, <<"my_exchange">>}, {<<"x-dead-letter-routing-key">>,longstr, <<"task_pool1">>}, {<<"x-message-ttl">>, signedint,60000}], durable = true} ),
when set argument have specify type (longstr, signedint)
.
i bound queue ex"my_exchange"
published message queue:"myqueue12"
, worked correctly:
hope helps.
Comments
Post a Comment