Module amqp_connection_mgr

Keep track of an AMQP connection.

Behaviours: gen_server.

Description

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.

Function Index

fetch/1Fetch the current connection from the manager.
start_link/2Start up the connection manager.

Function Details

fetch/1

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/2

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