pub fn dispatch(
state: &DispatchState,
envelope: &Envelope,
) -> Result<Option<SessionRef>>Expand description
One delivery becomes the work of one session, or waits for the session its scope sends it to.
The role’s scope decides which session takes the delivery and nothing else
does: oneshot opens a session for every delivery, task hands the
delivery to the session that already holds its family’s conversation, and
role hands it to whichever pooled session has waited longest. Ok(None)
is the third answer and it is not a refusal: the scope’s session is busy, or
every slot is spent, and the row stays in flight for the pull that comes
after one frees (plan §5 max_sessions).