pub struct SequenceClient { /* private fields */ }
Expand description
Client components should use |SequenceClient| to automatically manage interaction with server components. Clients should use |process_message(s)| to tell |SequenceClient| when they’ve processed a message. |SequenceClient| will then automatically discard batons at the appropriate times.
Implementations§
Source§impl SequenceClient
impl SequenceClient
Sourcepub fn new(message_source: MessageSourceProxy) -> Self
pub fn new(message_source: MessageSourceProxy) -> Self
Creates a new |SequenceClient|, but does not start its management. Clients should call |run| to start baton management.
Sourcepub async fn run(&self) -> Result<(), BatonError>
pub async fn run(&self) -> Result<(), BatonError>
Start baton management. This function will not return until the |MessageSourceProxy| passed to |new| closes, returns an error when read, or receives an invalid baton message.
Sourcepub async fn process_message(&self) -> Option<LeaseBaton>
pub async fn process_message(&self) -> Option<LeaseBaton>
Tell |SequenceClient| that a message was processed. If a baton is held corresponding to this message, it is returned. Likely the only valid reason for the caller to hold on to the baton is to pass it to it’s client(s).
Sourcepub async fn process_messages(&self, message_count: u64) -> Option<LeaseBaton>
pub async fn process_messages(&self, message_count: u64) -> Option<LeaseBaton>
Tell |SequenceClient| that |message_count| messages were processed. If a baton is held corresponding to one of the messages, it is returned. Likely the only valid reason for the caller to hold on to the baton is to pass the baton to it’s client(s).