pub struct ControllerTask { /* private fields */ }Expand description
The driver, the rumqttc event loop and the command executor, as one future.
Implementations§
Source§impl ControllerTask
impl ControllerTask
Sourcepub fn reresolve(self, f: Reresolve) -> Self
pub fn reresolve(self, f: Reresolve) -> Self
Looks the broker up again while its address may have changed: after
the first failed connect since the task started or since the last
successful connect, and after every third failed connect after that,
the connection calls f, and options it returns replace the event
loop’s before the next attempt. They keep the inflight cap and
manual-ack setting of the options the task was built with. f
returning None keeps the current options. Calls start with the
first connect, so a broker that got a new address while the host was
off is found at it. A host that found its broker over mDNS returns
the same broker at its new address; one connected by a host name, or
to a configured broker, needs no hook.
Sourcepub async fn run(self) -> Result<(), Error>
pub async fn run(self) -> Result<(), Error>
Runs until ControllerHandle::shutdown: the driver; an
EventLoop::poll loop that feeds the inbox and reconnects with a
1-30 s backoff; and a command executor, separate so a full request
channel cannot deadlock against poll. After the shutdown’s
UNSUBSCRIBE the executor sends a DISCONNECT, and the task ends once it
is written, or at once when the link is down, discarding the commands
not yet written. The future is Send.
The three run in one task. The driver yields between batches of received messages, so a backlog does not starve the event loop.