RabbitHutch.Connection behaviour (rabbit_hutch v1.0.0)

Link to this section Summary

Callbacks

Returns a channel for the given process.

Initializes the connection, returning the connection options.

Link to this section Types

Specs

error() :: :no_connection | :timeout

Link to this section Functions

Link to this function

handle_call(arg1, from, state)

Link to this function

handle_info(arg1, state)

Link to this function

start_link(module, opts \\ [])

Link to this section Callbacks

Link to this callback

channel(pid, opts)

Specs

channel(pid(), opts :: []) :: {:ok, pid()} | {:error, error :: error()}

Returns a channel for the given process.

The returned channel process will be monitored and

Options

  • :timeout - When not connected, give this much time in milliseconds to wait for a reconnection, or return {:error, :timeout}

    If nil, return {:error, :no_connection} when not able to open a channel process. Default: nil

Specs

init(opts :: []) :: {:ok, opts :: []}

Initializes the connection, returning the connection options.

Returned options

  • :username - The name of a user registered with the broker (defaults to “guest”);
  • :password - The password of user (defaults to “guest”);
  • :virtual_host - The name of a virtual host in the broker (defaults to “/“);
  • :host - The hostname of the broker (defaults to “localhost”);
  • :port - The port the broker is listening on (defaults to 5672);
  • :channel_max - The channel_max handshake parameter (defaults to 0);
  • :frame_max - The frame_max handshake parameter (defaults to 0);
  • :heartbeat - The hearbeat interval in seconds (defaults to 0 - turned off);
  • :connection_timeout - The connection timeout in milliseconds (defaults to infinity);
  • :ssl_options - Enable SSL by setting the location to cert files (defaults to none);
  • :client_properties - A list of extra client properties to be sent to the server, defaults to [];
  • :socket_options - Extra socket options. These are appended to the default options. See http://www.erlang.org/doc/man/inet.html#setopts-2 and http://www.erlang.org/doc/man/gen_tcp.html#connect-4 for descriptions of the available options.
Link to this callback

next_retry(retry_num)

Specs

next_retry(retry_num :: integer()) :: timeout_ms :: integer()
Link to this callback

start_link(opts)

Specs

start_link(opts :: []) :: {:ok, pid()} | {:error, term()}