Behaviours: gen_server.
Keep track of an AMQP connection.
This gen_server keeps track of an AMQP connection. It exposes the connection, but it also tracks whether or not the connection is still alive. If the connection dies, the process will crash. This will tell the supervisor tree of this process to close down and restart.
If the connection can not be established, the process will enter a repeated wait-state where it tries to reconnect every 30 seconds. As soon as it gets the connection it will begin operating normally and manage the connection.
Essentially this module is a supervisor tree link. It watches over RabbitMQs connections and injects a fault into its own supervisor tree whenever the RabbitMQ connection dies.fetch/1 | Fetch the current connection from the manager. |
start_link/2 | Start up the connection manager. |
fetch(RegName) -> {ok, pid()} | {error, Reason}
Fetch the current connection from the manager. Obtain the connection from the manager, if it has one.
start_link(RegName, ConnInfo) -> {ok, pid()}
Start up the connection manager.
You give the connection manager two parameters: RegName
is the name under which the
connection manager should register itself. ConnInfo
is the connection info the process
should use.
Generated by EDoc