Expand description
Rust core of the RustStream messaging
framework: broker-agnostic traits, message types, codecs, router runtime, and a
conformance harness for broker authors.
§Cargo features
The core traits, the runtime::RustStream application object, middleware, and dispatch are
always present. The rest is additive and opt-in. Codec features are mutually compatible and
enable only the deserializers you need.
json(default):codec::JsonCodec.msgpack: [codec::MsgpackCodec].cbor: [codec::CborCodec].memory: [memory::MemoryBroker], an in-process broker usable in applications, prototypes and tests.macros: the#[subscriber],#[ruststream::app], and#[derive(Message)]macros.asyncapi:AsyncAPIdocument generation and the HTML viewer.metrics: Prometheus metrics middleware and exporter.logging: colored,RUST_LOG-driven console logging viatracing-subscriber([logging::init]). The generatedcliruncommand installs it automatically.otel: OpenTelemetry SDK integration: OTLP export for traces and metrics via [otel::OtelBuilder::init], plus per-handler dispatch metrics middleware and W3C trace-context propagation ([otel::propagation]).conformance: the [conformance::harness] contract suite, per-capability suites in [conformance::capabilities], and broker-agnostic [conformance::helpers] for application tests. Generic over any broker’s [testing::TestableBroker], so it pulls in no concrete broker (enablememorytoo to run it against [memory::MemoryBroker]).testing: the [testing::TestApp] in-process harness for application unit tests.cli: theruststreambinary (run,asyncapi gen,new).
Disable defaults (default-features = false) to drop the bundled JSON codec; the core traits,
runtime, and dispatch remain. Add back only what you need.
Re-exports§
pub use runtime::RustStream;
Modules§
- codec
- Pluggable serialization codecs.
- runtime
- Application object, middleware and dispatch.
- testing
- Application unit-testing support, behind the
testingfeature.
Macros§
Structs§
- Buffered
- A
SubscriptionSourceadapter that buffers the wrapped source’s subscriber into aBatchSubscriber. - Buffered
Subscriber - The subscriber
Bufferedopens: the wrapped source’s subscriber plus client-side batching. - Headers
- Case-insensitive map of broker-message headers.
- Name
- The default
SubscriptionSource: subscribe by name string via theSubscribecapability. - Outgoing
Message - A message ready to be published, holding borrowed payload and name.
- Pair
Error - The error of
PublishPolicy::pair: whatever the broker reported while bringing a publisher alive, type-erased. - RawMessage
- An owned snapshot of a message as it travels through the framework.
- Security
Scheme - How clients authenticate to an
AsyncAPIserver, per theAsyncAPI3.0 security scheme types. - Seeker
Pending Error - The subscription behind a
SeekerTokenhas not been opened yet. - Seeker
Token - Resolves the
Seekerof a subscription mounted throughWithSeeker::attach. - Server
Spec - How to reach a broker, for the
serverssection of anAsyncAPIdocument. - StartAt
- A source decorator opening the subscription at a chosen position instead of the broker’s default.
- With
Seeker - A source decorator handing out the subscription’s
Seekerthrough aSeekerTokenminted before registration.
Enums§
- AckError
- Errors returned by
IncomingMessage::ackandIncomingMessage::nack. - ApiKey
Location - Where an
apiKeyscheme carries the key, perAsyncAPI3.0. - Http
ApiKey Location - Where an
httpApiKeyscheme carries the key, perAsyncAPI3.0.
Traits§
- Batch
Subscriber - A subscriber that natively delivers messages in batches.
- Broker
- An unconnected broker: configuration captured, no I/O performed yet.
- Build
Context - Builds a handler’s per-delivery context value from the broker message.
- Connected
Broker - A connected broker: the typed witness of a live connection.
- Context
Field - A
Field-style key that also names its context type and yields an owned value. - Default
Publish - A connected broker that names its plain publish policy, so the runtime can build a default
reply publisher when a
publish("dest")handler is included without an explicit one. - Describe
Server - A broker that describes itself as an
AsyncAPIserver. - Field
- A compile-time key reading one typed field out of
Src. - Field
Mut - A
Fieldkey middleware can also write, for per-delivery scratch values. - Incoming
Message - A message delivered by a
Subscriber. - Message
- Metadata about a message type, used to name and describe it in an
AsyncAPIdocument. - Owned
Transactions - A publisher that opens caller-owned, client-buffered transactions.
- Partitioned
- Messages or publishers that carry a routing key for broker-side partitioning.
- Positioned
- A delivered message that knows its own position in the broker’s replayable log.
- Publish
Policy - The declaration half of a publisher: pure policy, no connection, no publish surface.
- Publisher
- A producer that sends messages into the broker.
- Request
Reply - A publisher that supports synchronous request / reply messaging.
- Seekable
- A subscriber whose position in a replayable log can be moved.
- Seeker
- A clonable handle that repositions one subscription, minted by
Seekable::seeker. - Subscribe
- A connected broker whose subscriptions are fully determined by a name string.
- Subscriber
- A consumer attached to one or more broker names.
- Subscription
Source - A description of one subscription, resolved against a connected broker at startup.
- Transaction
- A client-buffered transaction that owns its buffer, opened by
OwnedTransactions::transaction. - Transactional
Publisher - A publisher that supports broker-side transactions.
Type Aliases§
- Connected
- Shorthand for a broker’s connected form, so bounds read
S: SubscriptionSource<Connected<B>>instead of spelling the associated type projection.