Guide

Verification Required

Message Broker Rust SDK examples.

Tested Rust SDK workflows for Message Broker stream publish, replay, cursor commit, shared queue processing, retry, and dead-letter handling with controlled-beta route boundaries.

Current availability

Private Beta. Public beta is scheduled for .

Example Status

Rust Examples

Controlled Beta

These examples are tested against the current native API Cargo example targets and recorded expected output.

Page Review

Verification Required

Product SME and docs QA still need to accept the exact SDK wording, route maturity notes, and whether these commands enter docs CI.

Example Snapshot

Example status
Tested
Rust examples
4
Validation
Cargo examples
Evidence
SMB-EVID-013

Source Files

Example source bundle
WorkflowStatusValidationSource
Publish, replay, and cursor committestedcargo run --example publish_replaydocs/examples/message-broker/rust-sdk-examples/snippets/publish-replay.rs
Shared queue ack, nack, and redeliverytestedcargo run --example shared_queue_processingdocs/examples/message-broker/rust-sdk-examples/snippets/shared-queue-processing.rs
HTTP queue retry, dead-letter, and DLQ replaytestedcargo run --example http_queue_workerdocs/examples/message-broker/rust-sdk-examples/snippets/http-queue-worker.rs
Failure-policy retry exhaustiontestedcargo run --example retry_dead_letterdocs/examples/message-broker/rust-sdk-examples/snippets/retry-dead-letter.rs

Example Guardrails

Tested Examples

The source snippets map to current Cargo example targets that compile and run with deterministic output.

Review Required Page

The rendered page remains verification-required until Message Broker product SME and docs QA reviewers accept exact SDK wording and route maturity notes.

Remote Boundary

In-process examples use InMemoryBroker. The HTTP example uses a scripted transport, so live remote auth and network behavior stay tied to reference and compatibility docs.

Rust SDK Snippets

Message Broker Rust SDK examples

Switch between tested Rust SDK example targets. Live endpoint auth and network behavior still belong to the HTTP reference.

Rust

docs/examples/message-broker/rust-sdk-examples/snippets/publish-replay.rs

Creates a local stream, publishes records, replays from earliest, and commits a cursor.

let broker = InMemoryBroker::with_start_time(Timestamp::from_unix_millis(10_000));
let mut client = NativeClient::new(broker, ClientConfig::new("telemetry-producer"))?;

client.create_stream(
    "telemetry",
    DurabilityMode::LocalDisk,
    RetentionPolicy::default(),
)?;

let first = client.publish(
    PublishMessage::new(
        "telemetry",
        Timestamp::from_unix_millis(1_700_000_000_000),
        b"reading-1".to_vec(),
    )
    .with_message_id("reading-1")
    .with_key(b"machine-17".to_vec()),
)?;

let batch = client.batch_publish(vec![
    PublishMessage::new(
        "telemetry",
        Timestamp::from_unix_millis(1_700_000_000_001),
        b"reading-2".to_vec(),
    )
    .with_message_id("reading-2"),
    PublishMessage::new(
        "telemetry",
        Timestamp::from_unix_millis(1_700_000_000_002),
        b"reading-3".to_vec(),
    )
    .with_message_id("reading-3"),
])?;

let replay = client.subscribe_replay("telemetry", "analytics", StartPosition::Earliest)?;
let fetched = client.fetch(&replay, 10)?;

client.commit_cursor("telemetry", "analytics", "processed", fetched.next_offset)?;

Coverage Map

Behavior, SDK surface, and evidence mapping
BehaviorSDK surfaceEvidenceMaturity
Create stream with local-disk durabilityNativeClient::create_streamSMB-EVID-013 and publish_replay.rsControlled beta
Publish one record and a batchPublishMessage, NativeClient::publish, NativeClient::batch_publishSMB-EVID-013 and publish_replay.rsControlled beta
Replay from earliest and commit cursorsubscribe_replay, fetch, commit_cursorSMB-EVID-013 and publish_replay.rsControlled beta
Fetch queue work and ack successful deliverysubscribe_queue, fetch, ackSMB-EVID-013 and shared_queue_processing.rsControlled beta
Nack and redeliver worknack and queue fetchSMB-EVID-013 and shared_queue_processing.rsControlled beta
Retry and dead-letter through HTTP clientHttpNativeClient::retry_delivery and dead_letterSMB-EVID-013 and http_queue_worker.rsVerification required for live remote endpoint posture
Apply failure policy and inspect DLQconfigure_failure_policy and subscribe_replaySMB-EVID-013 and retry_dead_letter.rsControlled beta with review-required wording

Expected Output

These lines come from the current product example binaries. Keep them synthetic and update them only when the SDK example behavior changes.

Text

Expected Output

Safe deterministic output recorded from the current Rust example binaries.

workflow=publish_replay published_offsets=[0, 1, 2]
workflow=publish_replay replayed=3 next_offset=3
workflow=publish_replay committed_cursor=processed offset=3

workflow=shared_queue acked_offset=0 delivery_id=del-1
workflow=shared_queue nacked_offset=1 will_redeliver=true
workflow=shared_queue redelivered_offset=1 attempt=2

workflow=http_queue_worker retry_scheduled delivery_id=del-1 available_at=1700000000250
workflow=http_queue_worker dead_lettered source_offset=0 dead_letter_stream=jobs.dlq dead_letter_offset=0
workflow=http_queue_worker dlq_message_id=dead-letter:jobs:0:del-2 payload=job-1

workflow=retry_dead_letter first_action=ScheduledRetry available_at=30104
workflow=retry_dead_letter exhausted_action=DeadLettered dead_letter_stream=jobs.dlq dead_letter_offset=0
workflow=retry_dead_letter dlq_message_id=job-1.dead-letter.del-2 original_offset=0 attempt=2 reason=still unavailable

Validation And Evidence

DOCS-059 validation evidence
CommandWhat it provesReviewer status
cargo check --quiet --manifest-path .../Service.MessageBroker/Cargo.toml -p stornamics-message-broker-native --examplesAll native API Rust example targets compile.passed on 2026-08-16
cargo run --quiet ... --example publish_replayStream publish, batch publish, replay count, next offset, and cursor commit output.passed on 2026-08-16
cargo run --quiet ... --example shared_queue_processingQueue ack, nack, redelivery, and delivery attempt output.passed on 2026-08-16
cargo run --quiet ... --example http_queue_workerHTTP client retry scheduling, dead-letter response parsing, and DLQ record listing with scripted transport.passed on 2026-08-16
cargo run --quiet ... --example retry_dead_letterFailure policy scheduled retry, retry exhaustion, dead-letter stream output, and DLQ replay metadata.passed on 2026-08-16

Route Maturity Notes

Stream, replay, cursor, queue, retry, and dead-letter examples stay scoped to Message Broker controlled-beta behavior. Use the compatibility matrix before strengthening SDK, auth, replication, or Kafka compatibility claims.

Safe Next Steps

  • Available: DOCS-023

    Run the local quickstart

    Use the curl workflow for a copy/paste first success before adapting Rust SDK code.

  • Available: DOCS-032

    Read CLI and SDK reference

    Use lifecycle flags, diagnostics, remote boundaries, and SDK entry point names when extending examples.

  • Available: DOCS-040

    Check route and auth scope

    Confirm route maturity, auth modes, queue behavior, and Kafka boundaries before adding more SDK flows.

  • Available: DOCS-063

    Add example validation

    Use the manifest gate alongside product Cargo checks before changing status or evidence wording.