pub struct Connector { /* private fields */ }Expand description
Runs in the background, maintains no more than one active connection to a
RabbitMQ cluster (referred to herein as current connection) identified
by the given Handle. Exposes a cheaply clone-able Gateway, which
any number of asynchronous tasks can use to retrieve a fresh Channel
created in the current connection.
Fully encapsulates reconnection and clean-up logic. Reconnection is triggered whenever a channel is requested and this connector is unable to produce it (likely, because there is no connectivity to the RabbitMQ cluster). Reconnections are performed with an exponential backoff strategy. All connections are properly closed in the background before discarding.
The clients should keep their copy of Gateway and re-use it to request
a new Channel whenever the previous channel seems to be no longer
working (e.g., the underlying connection was lost). The clients should
expect that the gateway may take a long or even indefinite time, depending
on the RabbitMQ cluster availability.
This connector is integrated with AppSpindown: once the global
AppContext is terminated, this connector will stop serving channels and
will attempt to gracefully close the current connection.