ExRabbitMQ v2.10.0 ExRabbitMQ.Connection View Source
A GenServer
implementing a long running connection to a RabbitMQ server.
Consumers and producers share connections and when a connection reaches the limit of
65535
channels, a new connection is established.
To correctly monitor the open channels, users must not open channels manually (e.g., in the provided hooks).
Internally, a connection GenServer
uses :pg2
and :ets
to handle local subscriptions of consumers and producers.
:pg2
is used to name the pool of connections to RabbitMQ.
Only local members are considered so clustering cannot cause problems with local subscriptions.
:ets
is used to hold the subscriptions of consumers and producers that are using the table holding connection GenServer
instance.
Link to this section Summary
Functions
Gracefully closes the RabbitMQ connection and terminates its GenServer handler identified by connection_pid
Checks whether this process holds a usable connection to RabbitMQ
Subscribes a consumer process, via self()
, to the managed ETS table
Link to this section Functions
Gracefully closes the RabbitMQ connection and terminates its GenServer handler identified by connection_pid
.
Checks whether this process holds a usable connection to RabbitMQ.
connection_pid
is the GenServer pid implementing the called ExRabbitMQ.Connection
)
subscribe(pid, term) :: true | false
Subscribes a consumer process, via self()
, to the managed ETS table.
If the ETS table already contains 65535 consumers, and thus the maximum allowed 65535 channels, then the subscription is not allowed so that a new connection can be created.
connection_pid
is the GenServer pid implementing the called ExRabbitMQ.Connection
connection_config
is the connection config that the ExRabbitMQ.Connection
has to be using
in order to allow the subscription