ruststream-gcp-pubsub connects a RustStream service to Google Cloud Pub/Sub over the official
google-cloud-pubsub client. Handlers, routing,
codecs and middleware come from the framework; this crate is the transport.
Features
- Streaming pull with ack deadlines extended in the background while a handler runs.
- Native acknowledgement, with the confirmed forms on exactly-once subscriptions.
- Retry caps as the subscription's own dead-letter policy, and delayed retries held under the delivery's lease.
- Ordering keys as a per-message setting.
- Plain Pub/Sub messages: headers ride attributes, with no envelope.
- Batches assembled on the client.
- The emulator as a target, with topics and subscriptions created on subscribe for local development.
- AsyncAPI under the
googlepubsubprotocol, behind theasyncapifeature. - Tests on the production app:
TestAppruns it withPubSubBrokerconnected in process.
Install
[]
= { = "0.7", = ["macros", "json"] }
= "0.7"
= { = "1", = ["derive"] }
[]
= { = "0.7", = ["testing"] }
Write a service
use *;
use ;
async
#[ruststream::app] generates main, so the binary understands run and asyncapi gen. A plain
name subscribes to a subscription that already exists; GooglePubSub describes one with options.
Test it
TestApp runs the app main runs with PubSubBroker connected in process, with no server.
use TestApp;
let tb = start.await?;
tb.
.message
.to
.publish
.await?;
tb.
.assert_called_once
.
.with;
Documentation
- This crate: https://docs.rs/ruststream-gcp-pubsub
- The framework: https://powersemmi.github.io/ruststream/latest
Minimum supported Rust version
The MSRV is 1.95, edition 2024.
Contributing
See CONTRIBUTING.md.
License
Licensed under the Apache-2.0 license.