From: Matt Mullins Date: Sun, 28 Aug 2011 20:37:14 +0000 (-0500) Subject: Link the AMQP channel to the process listening, so that it can correct server problems. X-Git-Tag: v5~16 X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=66e2ccda9ff74e245b0f9526483064264593ec6f;p=erlbot.git Link the AMQP channel to the process listening, so that it can correct server problems. --- diff --git a/amqp/amqp_bot_listener.erl b/amqp/amqp_bot_listener.erl index 3fde833..0b54c34 100644 --- a/amqp/amqp_bot_listener.erl +++ b/amqp/amqp_bot_listener.erl @@ -17,8 +17,12 @@ %% %% Note this calls basic.consume with no_ack=true, so messages are %% automatically removed from the queue when they occur +%% +%% This links the Channel to the current process so that it can handle, for +%% instance, the AMQP server dying. listen_for_events(RoutingKeyString) -> {ok, Channel} = amqp_bot_connection:open_channel(), + link(Channel), RoutingKeyBinary = list_to_binary(RoutingKeyString), Pid = self(), #'exchange.declare_ok'{} = amqp_channel:call(Channel,