[rabbitmq-discuss] Send durable messages

Alvaro Videla videlalvaro at gmail.com
Wed Dec 11 22:21:18 GMT 2013


Hi,

You need to set the delivery_mode = 2

See https://github.com/rabbitmq/rabbitmq-tutorials/blob/master/erlang/new_task.erl#L22

Regards,

Alvaro

On Wed, Dec 11, 2013 at 8:54 PM, Kaveh Shahbazian
<kaveh.shahbazian at gmail.com> wrote:
> Hi, I want to send durable messages. But when I add 'durable = true' in
> publish or message it complains that there is no such field in that record.
>
> here is my code:
>
> send() ->
>     {ok, Connection} = amqp_connection:start(#amqp_params_network{ host =
> "localhost" }),
>     {ok, Channel} = amqp_connection:open_channel(Connection),
>
>     amqp_channel:call(Channel, #'queue.declare'{queue = <<"q1_queue">>,
> durable = true}),
>     amqp_channel:cast(Channel,
>                       #'basic.publish'{
> exchange = <<"">>,
> routing_key = <<"q1_queue">>
> },
>                       #amqp_msg{
> payload = <<"Hello World!">>
> }),
>     io:format(" [x] Sent 'Hello World!'~n"),
>     ok = amqp_channel:close(Channel),
>     ok = amqp_connection:close(Connection),
>     ok.
>
> Thanks;
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>


More information about the rabbitmq-discuss mailing list