pub struct DomainClient {
pub command_handler: CommandHandlerClient,
pub query: QueryClient,
pub speculative: SpeculativeClient,
}Expand description
Per-domain client combining command execution, event querying, and speculative operations.
Connects to a single domain’s endpoint and provides:
- Command execution via
command_handler - Event querying via
query - Speculative (what-if) execution via
speculative
Matches the distributed architecture where each domain has its own coordinator service.
Fields§
§command_handler: CommandHandlerClientCommand handler client for command execution.
query: QueryClientQuery client for event retrieval.
speculative: SpeculativeClientSpeculative client for dry-run and what-if scenarios.
Implementations§
Source§impl DomainClient
impl DomainClient
Sourcepub async fn connect(endpoint: &str) -> Result<Self>
pub async fn connect(endpoint: &str) -> Result<Self>
Connect to a domain’s coordinator at the given endpoint.
Supports both TCP (host:port) and Unix Domain Sockets (file paths).
Sourcepub async fn from_env(env_var: &str, default: &str) -> Result<Self>
pub async fn from_env(env_var: &str, default: &str) -> Result<Self>
Connect using an endpoint from environment variable with fallback.
Sourcepub fn from_channel(channel: Channel) -> Self
pub fn from_channel(channel: Channel) -> Self
Create a client from an existing channel.
Sourcepub async fn execute(&self, command: CommandBook) -> Result<CommandResponse>
pub async fn execute(&self, command: CommandBook) -> Result<CommandResponse>
Execute a command asynchronously (fire-and-forget).
Use execute_with_mode() to specify a different sync mode.
Sourcepub async fn execute_with_mode(
&self,
command: CommandBook,
sync_mode: SyncMode,
) -> Result<CommandResponse>
pub async fn execute_with_mode( &self, command: CommandBook, sync_mode: SyncMode, ) -> Result<CommandResponse>
Execute a command with the specified sync mode.
Use SyncMode::Async for fire-and-forget (default).
Use SyncMode::Simple to wait for sync projectors.
Use SyncMode::Cascade for full sync including saga cascade.
Sourcepub async fn get_events(&self, query: Query) -> Result<EventBook>
pub async fn get_events(&self, query: Query) -> Result<EventBook>
Query events (delegates to query client).
Trait Implementations§
Source§impl Clone for DomainClient
impl Clone for DomainClient
Source§fn clone(&self) -> DomainClient
fn clone(&self) -> DomainClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl GatewayClient for DomainClient
impl GatewayClient for DomainClient
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
command: CommandBook,
) -> Pin<Box<dyn Future<Output = Result<CommandResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
command: CommandBook,
) -> Pin<Box<dyn Future<Output = Result<CommandResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl QueryClient for DomainClient
impl QueryClient for DomainClient
Auto Trait Implementations§
impl !Freeze for DomainClient
impl !RefUnwindSafe for DomainClient
impl Send for DomainClient
impl Sync for DomainClient
impl Unpin for DomainClient
impl UnsafeUnpin for DomainClient
impl !UnwindSafe for DomainClient
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> CommandBuilderExt for Twhere
T: GatewayClient,
impl<T> CommandBuilderExt for Twhere
T: GatewayClient,
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