KubeMQ
Client SDKsRustReference

Events Store

EventStore, replay types, and persistent pub/sub operations

EventStore

Outbound persistent event message. Unlike Event, store messages are persisted and can be replayed.

FieldTypeDescription
idStringMessage ID (auto-generated UUID v4 when empty)
channelStringTarget channel name (required)
metadataStringOptional UTF-8 metadata
bodyVec<u8>Message payload bytes
client_idStringSender identity override
tagsHashMap<String, String>Arbitrary key-value pairs

Builder

main.rs
let event = EventStore::builder()
    .channel("orders.created")
    .body(b"order-data".to_vec())
    .add_tag("priority", "high")
    .build();

EventStoreResult

Returned by send_event_store.

FieldTypeDescription
idStringServer-assigned event identifier
sentboolWhether the server persisted the event
errorStringServer error message when sent is false

EventStoreReceive

Received from a subscription callback.

FieldTypeDescription
idStringServer-assigned event identifier
sequenceu64Monotonic sequence number
timestampi64Server timestamp (Unix nanoseconds)
channelStringChannel the event was published to
metadataStringPublisher metadata
bodyVec<u8>Message payload
tagsHashMap<String, String>Publisher-attached tags

EventsStoreSubscription

Specifies where a subscription should begin reading.

VariantDescription
StartNewOnlyOnly events published after subscription
StartFromFirstReplay from the first stored event
StartFromLastStart from the most recent event
StartAtSequence(u64)Start at a specific sequence number
StartAtTime(SystemTime)Start at a specific wall-clock time
StartAtTimeDelta(Duration)Start from now - delta (server interprets in seconds)

Client Methods

send_event_store

main.rs
let result = client.send_event_store(event).await?;
println!("Stored event ID: {}", result.id);

subscribe_to_events_store

main.rs
let sub = client.subscribe_to_events_store(
    "orders.created",
    "",
    EventsStoreSubscription::StartFromFirst,
    |event| Box::pin(async move {
        println!("Seq {}: {}", event.sequence, String::from_utf8_lossy(&event.body));
    }),
    None,
).await?;

send_event_store_stream

Opens a bidirectional stream. Returns an EventStoreStreamHandle.

main.rs
let mut handle = client.send_event_store_stream().await?;
handle.send(event).await?;
handle.close();

Was this page helpful?

On this page