Skip to content

Instantly share code, notes, and snippets.

@hntrmrrs
Created June 15, 2011 13:35
Show Gist options
  • Save hntrmrrs/1027098 to your computer and use it in GitHub Desktop.
Save hntrmrrs/1027098 to your computer and use it in GitHub Desktop.
open_connection_link(Params) ->
process_flag(trap_exit, true),
{ok, Conn} = amqp_connection:start(network, Params),
link(Conn),
receive
{'EXIT', Conn, Reason} ->
exit(Reason);
{'EXIT', _Pid, Reason} ->
ok = amqp_connection:close(Conn),
exit(Reason)
after 0 ->
process_flag(trap_exit, false)
end,
{ok, Conn}.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment