pub struct Submit { /* private fields */ }Expand description
A command to submit with Kernable::submit or Kernable::enqueue, built with methods
that each return the changed command:
Submit::new("shop", "cart", "c1", "AddItem").data(json!({ "qty": 2 })).wait(Wait::Committed).
Without data, the payload is an empty object ({}).
Implementations§
Source§impl Submit
impl Submit
Sourcepub fn new(
domain: &str,
aggregate_type: &str,
aggregate_id: &str,
command_type: &str,
) -> Submit
pub fn new( domain: &str, aggregate_type: &str, aggregate_id: &str, command_type: &str, ) -> Submit
A command_type command of domain for the aggregate aggregate_type with ID
aggregate_id.
Sourcepub fn command<C: CommandType>(command: C, aggregate_id: &str) -> Submit
pub fn command<C: CommandType>(command: C, aggregate_id: &str) -> Submit
Sourcepub fn tenant(self, tenant: impl Into<String>) -> Submit
pub fn tenant(self, tenant: impl Into<String>) -> Submit
The tenant to submit to. Default: the connection’s (Options::tenant).
Sourcepub fn id(self, id: impl Into<String>) -> Submit
pub fn id(self, id: impl Into<String>) -> Submit
Idempotency key (default: a new UUID); resubmitting the same ID returns the original outcome without running the command again.
Sourcepub fn context(self, context: RequestContext) -> Submit
pub fn context(self, context: RequestContext) -> Submit
Replaces the client’s default context; inside a listener, pass ctx.follow().
Sourcepub fn at(self, time: SystemTime) -> Submit
pub fn at(self, time: SystemTime) -> Submit
Kernable::enqueue only: a scheduled command, run at time and not before. The kernel
stores it at once; the aggregate’s other commands pass meanwhile, and middlewares check
it now and again when it is due. At most the kernel’s --schedule-max-days (default 366)
ahead. Cancel it with Kernable::cancel.
Sourcepub fn until(self, time: SystemTime) -> Submit
pub fn until(self, time: SystemTime) -> Submit
With Submit::at: if the command cannot run by time (after an outage, say), it is
rejected expired instead of running late. Without at, submitting or enqueueing it is
Error::Config.
Sourcepub fn wait(self, wait: Wait) -> Submit
pub fn wait(self, wait: Wait) -> Submit
How long Kernable::submit waits: Wait::Settled (default) or Wait::Committed.
Sourcepub fn timeout(self, timeout: Duration) -> Submit
pub fn timeout(self, timeout: Duration) -> Submit
How long to wait for the connection and the outcome; default Options::timeout.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Submit
impl !UnwindSafe for Submit
impl Forget for Submit
impl Freeze for Submit
impl Move for Submit
impl Send for Submit
impl Sync for Submit
impl Unpin for Submit
impl UnsafeUnpin for Submit
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
T in a tonic::Request