pub struct CommandBuilder<'a, C: GatewayClient> { /* private fields */ }Expand description
Builder for constructing and executing commands.
Implementations§
Source§impl<'a, C: GatewayClient> CommandBuilder<'a, C>
impl<'a, C: GatewayClient> CommandBuilder<'a, C>
Sourcepub fn with_correlation_id(self, id: impl Into<String>) -> Self
pub fn with_correlation_id(self, id: impl Into<String>) -> Self
Set the correlation ID for request tracing. If not set, a random UUID will be generated.
Sourcepub fn with_sequence(self, seq: u32) -> Self
pub fn with_sequence(self, seq: u32) -> Self
Set the expected sequence number for optimistic locking. This is required - the builder will fail without it.
Sourcepub fn with_merge_strategy(self, strategy: MergeStrategy) -> Self
pub fn with_merge_strategy(self, strategy: MergeStrategy) -> Self
Set the merge strategy for conflict resolution.
Defaults to MergeCommutative.
Sourcepub fn with_command<M: Message>(
self,
type_url: impl Into<String>,
message: &M,
) -> Self
pub fn with_command<M: Message>( self, type_url: impl Into<String>, message: &M, ) -> Self
Set the command type URL and message.
Sourcepub fn build(self) -> Result<CommandBook>
pub fn build(self) -> Result<CommandBook>
Build the CommandBook without executing.
Sourcepub async fn execute(self) -> Result<CommandResponse>
pub async fn execute(self) -> Result<CommandResponse>
Execute the command.
Auto Trait Implementations§
impl<'a, C> Freeze for CommandBuilder<'a, C>
impl<'a, C> RefUnwindSafe for CommandBuilder<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for CommandBuilder<'a, C>
impl<'a, C> Sync for CommandBuilder<'a, C>
impl<'a, C> Unpin for CommandBuilder<'a, C>
impl<'a, C> UnsafeUnpin for CommandBuilder<'a, C>
impl<'a, C> UnwindSafe for CommandBuilder<'a, C>where
C: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request