Function wait_ack
pub async fn wait_ack<C>(
core: &Mutex<C>,
notify: Arc<Notify>,
limit: Duration,
state: impl Fn(&C) -> (SubState, Option<String>),
) -> Result<(), Error>Expand description
Waits for the broker to confirm a new subscription.
state reads the state of the subscription from the core. The wait ends with Ok when the subscription is
active (the broker confirmed it, or data came), with [brokapi_core::Error::Rejected] (subscription_refused)
when the broker refused it, and with [brokapi_core::Error::Transport] when limit passes with no answer.
The caller then takes the subscription back: it is not left half open. See [brokapi_runtime::wait_ack].
§Errors
[brokapi_core::Error::Rejected] with the text of the broker when the subscription was refused,
[brokapi_core::Error::Transport] when it was not confirmed in time.