Skip to content

ruststream-gcp-pubsub

ruststream-gcp-pubsub runs a RustStream service on Google Cloud Pub/Sub, over the official google-cloud-pubsub client.

A streaming pull subscription is the message stream a handler reads. Acknowledgement is native and per message. On an exactly-once subscription acknowledgement takes the confirmed form. An ordering key is the framework's partition key.

ruststream = { version = "0.7", features = ["macros", "json"] }
ruststream-gcp-pubsub = "0.7"
serde = { version = "1", features = ["derive"] }

The crate is published on crates.io and tracks the ruststream 0.7 line. Its MSRV is 1.95, set by the framework core.

You assemble a Pub/Sub service in the app function:

crates/ruststream-gcp-pubsub/examples/pubsub_service.rs
#[ruststream::app]
fn app() -> impl App {
    RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
        PubSubBroker::new("my-project").emulator("localhost:8085"),
        |b| {
            b.include(handle);
        },
    )
}

What the crate gives you

One subscription descriptor carries every setting a subscription has: flow control, how far the ack deadline is extended, how long a partial batch waits, and how long one delivery may stay unsettled. A retry cap and a dead-letter topic named at the mount site become the subscription's own dead-letter policy, so the service publishes no retry copies. Publishing adds one per-message setting, the ordering key, which a call site, a partition key header or the mount site may name. With the testing feature, a test runs the app main runs, with PubSubBroker connected in process and no server.

Where to go next

  • Crate reference - subscribing, publishing, the prelude, the AsyncAPI document, testing, operations.
  • RustStream docs - installation, the tutorial, the list of brokers.
  • Framework reference - writing subscribers, routing, codecs, middleware, the CLI.

How this site relates to the RustStream docs

This site is the entry page of the Pub/Sub broker. Everything the broker itself offers is on docs.rs, and the framework is documented with its own crate and on the RustStream site.