force-pubsub
Salesforce Pub/Sub API (gRPC) client for Rust — part of the force-rs workspace.
force-pubsub provides a streaming gRPC client for the Salesforce Pub/Sub API, enabling real-time event consumption and publishing with Avro-encoded Change Data Capture (CDC) events, Platform Events, and custom channels.
Features
- Subscribe to CDC events, Platform Events, and custom channels with automatic Avro decoding
- Publish events with schema-aware Avro encoding and delivery confirmation
- Schema caching with concurrent
DashMap-backed cache for high-throughput workloads - Reconnection with configurable backoff, replay support, and managed resubscription
- Authentication via the
forcecrate'sSession(Client Credentials, JWT, etc.)
Quick Start
use ;
// Build a force Session first (see force crate docs)
let session = /* ... */;
let config = default;
let handler = connect.await?;
// Subscribe to Change Data Capture events
let mut stream = handler
.subscribe
.await?;
while let Some = stream.next.await
Dependencies
This crate depends on the force crate for authentication and session management.
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.