hare v0.2.2 Hare.Core.Conn.State
This module defines the Conn.State
struct that holds the state of
the Conn
process.
State fields
bridge
- Keeps AMQP connection related statewaiting
- Keeps clients waiting for a channelreply
- A function to reply to waiting clients with a channel
Waiting clients
When connection is established a channel is opened for each waiting client, and the reply function is called with the client and a channel.
Summary
Functions
Establishes connection
Disconnects the bridge
It checks whether the given reference is the monitoring reference of the current established connection
Returns the Bridge conn
Creates a new Conn.State
struct
It attempts to open a new channel
Types
t() :: %Hare.Core.Conn.State{bridge: Hare.Core.Conn.State.Bridge.t, reply: reply, waiting: Hare.Core.Conn.State.Waiting.t}
Functions
Establishes connection.
On success replies to all waiting clients with a channel.
On failure returns {:retry, interval, state}
expecting the
caller to wait for that interval before calling connect/1 again.
It checks whether the given reference is the monitoring reference of the current established connection.
Returns the Bridge conn.
Creates a new Conn.State
struct.
It attempts to open a new channel.
If the connection is established, it uses the reply function to send the
result to the client. {:ok, Hare.Core.Chan.t}
on success and {:error, reason}
on failure.
If the connection is not established, it adds the client to the waiting list and tries to reopen the channel and reply when the connection is established.