Expand description
§KubeMQ Rust SDK
Client library for the KubeMQ message broker. Supports Events, Events Store, Commands, Queries, and Queues messaging patterns over gRPC with automatic reconnection, TLS/mTLS, and structured error handling.
§Features
- Events (Pub/Sub) — fire-and-forget fan-out messaging via
Event - Events Store — persistent events with replay via
EventStoreandEventsStoreSubscription - Queues — transactional message queues with ack/nack/requeue via
QueueMessage - Commands — request-response with timeout via
CommandandCommandResponse - Queries — request-response with caching via
QueryandQueryResponse - Auto-reconnection — configurable retry with exponential backoff via
RetryPolicy - TLS / mTLS — secure connections via
TlsConfig - Auth tokens — static or dynamic authentication via
CredentialProvider
§Quick Start
use kubemq::prelude::*;
#[tokio::main]
async fn main() -> kubemq::Result<()> {
let client = KubemqClient::builder()
.host("localhost")
.port(50000)
.build()
.await?;
let info = client.ping().await?;
println!("Connected to {} v{}", info.host, info.version);
client.close().await?;
Ok(())
}§Error Handling
All fallible operations return Result<T>, which is an alias for
std::result::Result<T, KubemqError>. Use KubemqError::is_retryable() to
determine if an operation can be retried, and KubemqError::code() for
machine-readable classification.
Modules§
- channel_
type - String constants identifying the five KubeMQ channel types.
- prelude
- Commonly used types and traits re-exported for convenience.
- queue_
downstream_ type - Backward-compatible
i32constants forQueueDownstreamTypevariants.
Structs§
- AckAll
Queue Messages Request - Request to acknowledge all pending messages in a queue channel.
- AckAll
Queue Messages Response - Response from an acknowledge-all queue messages operation.
- Channel
Info - Information about a KubeMQ channel returned by
KubemqClient::list_channels(). - Channel
Stats - Directional message statistics for a channel.
- Client
Config - Client configuration for connecting to a KubeMQ broker.
- Client
Config Builder - Builder for creating a
ClientConfigand connecting aKubemqClient. - Command
- Outbound command request for the RPC (Command/Query) pattern.
- Command
Builder - Builder for constructing
Commandinstances using a fluent API. - Command
Receive - A command received from a subscription callback.
- Command
Reply - Outbound command reply sent by a subscriber via
KubemqClient::send_command_response(). - Command
Reply Builder - Builder for constructing
CommandReplyinstances using a fluent API. - Command
Response - Response received after sending a command via
KubemqClient::send_command(). - Event
- Outbound fire-and-forget event message for the Pub/Sub pattern.
- Event
Builder - Builder for constructing
Eventinstances using a fluent API. - Event
Receive - An event received from a subscription callback.
- Event
Store - Outbound persistent event message for the Events Store (Pub/Sub) pattern.
- Event
Store Builder - Builder for constructing
EventStoreinstances using a fluent API. - Event
Store Receive - A persistent event received from an Events Store subscription callback.
- Event
Store Result - Result of a single event store send operation.
- Event
Store Stream Handle - Handle for a bidirectional event store send stream.
- Event
Stream Handle - Handle for a bidirectional event send stream.
- Event
Stream Result - Per-event result returned from a streaming send via
EventStreamHandle. - Kubemq
Client - Thread-safe KubeMQ client. Clone is cheap (Arc-based).
- Poll
Request - Configuration for a queue poll operation.
- Poll
Response - Response from a queue poll operation containing received messages.
- Query
- Outbound query request for the RPC (Command/Query) pattern.
- Query
Builder - Builder for constructing
Queryinstances using a fluent API. - Query
Receive - A query received from a subscription callback.
- Query
Reply - Outbound query reply sent by a subscriber via
KubemqClient::send_query_response(). - Query
Reply Builder - Builder for constructing
QueryReplyinstances using a fluent API. - Query
Response - Response received after sending a query via
KubemqClient::send_query(). - Queue
Downstream Message - A received queue message with per-message settlement methods.
- Queue
Downstream Receiver - Persistent queue downstream receiver for polling and settling messages.
- Queue
Message - A message for the Queue (point-to-point) messaging pattern.
- Queue
Message Attributes - Server-assigned attributes present on received queue messages.
- Queue
Message Builder - Builder for constructing
QueueMessageinstances using a fluent API. - Queue
Policy - Delivery policy for a queue message.
- Queue
Send Result - Result of a single queue message send operation.
- Queue
Upstream Handle - Handle for a bidirectional queue upstream (send) stream.
- Queue
Upstream Result - Per-batch result from a queue upstream send operation.
- Retry
Policy - Retry policy for transient operation errors and subscription reconnection.
- Server
Info - Information about the KubeMQ broker returned by
KubemqClient::ping(). - Static
Token Provider - A
CredentialProviderthat returns a fixed token with no expiration. - Subscription
- Handle for an active event, event-store, command, or query subscription.
- TlsConfig
- TLS configuration for connecting to a KubeMQ server.
Enums§
- Connection
State - The connection state of a
KubemqClient. - Error
Code - Machine-readable error codes for classifying
KubemqErrorvariants. - Events
Store Subscription - Specifies where an Events Store subscription should begin reading.
- Jitter
Mode - Jitter mode applied to exponential backoff calculations.
- Kubemq
Error - The primary error type returned by all SDK operations.
- Queue
Downstream Type - Request types for the queue downstream stream protocol.
Constants§
- VERSION
- SDK version string.
Traits§
- Credential
Provider - Credential provider for authentication.
Type Aliases§
- Async
Callback - Async callback signature for subscription message handlers.
- Async
Notify Callback - Async notification callback for lifecycle events.
- Result
- Convenience alias for
std::result::Result<T, KubemqError>.