Expand description
Application object, middleware and dispatch.
Modules§
- cli
- The process entry point generated by
#[ruststream::app]. - layers
- Bundled, opinionated middleware layers ready to drop into a handler stack.
Structs§
- After
- A builder for an outcome-gated post-settle hook, returned by
Context::after. - AppInfo
- Service-level metadata, surfaced to the
AsyncAPIgenerator as the specInfoobject. - Batch
Publish Transform Stack - Composes two
BatchPublishTransforms:innerruns first, thenouter. Built byTypedPublisher::batch_transform; you rarely name it directly. - Batch
Publishing Handler - The
BatchHandlerbuilt from aBatchPublishingDef: decode the batch, run the handler, publish the replies through theReplyPublisher, then ack the batch. - Batch
Transform Identity - The no-op
BatchPublishTransform: the default for aTypedPublisherwith no batch transforms. - Broker
Scope - A handler-registration scope bound to one broker.
- Context
- Per-delivery context, threaded through middleware and into the handler.
- DynStack
- A
Layerthat runs a frozen list ofDynMiddlewarebefore the handler it wraps. - DynStack
Handler - Handler produced by
DynStack::layer. Runs the frozen middleware chain, then the wrapped handler. - Failure
Policies - The pair of failure policies a subscriber carries: one for a handler panic, one for a decode
failure. Threaded from the def to the dispatch loop alongside the
Workerspolicy. - ForBatch
- Adapts a per-message
PublishTransforminto aBatchPublishTransform, applying it to each reply of a batch. Built byfor_batch. - Handler
Metadata - Descriptive metadata for a registered subscriber handler.
- Identity
- The identity
Layer: returns the handler unchanged. The default global stack onRustStream. - Next
- A cursor over the remaining middleware in a
DynStack, ending in the wrapped handler. - Outgoing
- A mutable outgoing message flowing through the publish pipeline.
- Publish
Context - A read-only view of the originating delivery, handed to a
PublishTransform. - Publish
DynNext - A cursor over the rest of a
PublishDynStack, ending in the surrounding static pipeline. - Publish
DynStack - A single static
PublishLayerwrapping a runtime-built, frozen list ofPublishDynLayer. - Publish
Identity - The terminal
PublishPipeline: no middleware, just the broker send. The default for an app with nopublish_layer. - Publish
Next - A cursor over the rest of the publish pipeline, ending in the broker send. Handed to a
PublishLayer; callrunto continue. - Publish
Stack - Prepends a
PublishLayerHeadto aPublishPipelineTail. Built byRustStream::publish_layer; you rarely name it directly. - Publish
Transform Identity - The no-op
PublishTransform: the default for aTypedPublisherwith no static transforms. - Publish
Transform Stack - Composes two
PublishTransforms:innerruns first, thenouter. Built byTypedPublisher::transform; you rarely name it directly. - Publishing
Handler - The
Handlerbuilt from aPublishingDef: decode, run, encode the reply, publish, ack. - Router
- A statically-typed, lazily-bound group of handler registrations, not attached to any broker.
- Router
Sink - The runtime collector a router mounts into: type-erased starters plus handler metadata.
- Rust
Stream - The top-level application object.
- Settle
- The settlement of one dispatched message: the
HandlerResultoutcome the dispatcher acts on, plus an optional post-settle continuation. - Stack
- Composes two layers into one:
inneris applied first (innermost),outerwraps it. - State
- Extractor that injects a piece of the shared application state into a handler.
- Transactional
- A
TypedPublisherwhose batch replies are published inside one broker transaction. - Typed
- Handler produced by
typed. Override the decode-failure policy withTyped::on_decode_failure. - Typed
Batch - The decode adapter for batches, the
Typedcounterpart. - Typed
Publisher - A byte
Publisherpaired with aCodecand a staticPublishTransformstack, ready to send typed values. - Workers
- Concurrency policy for one subscriber’s dispatch loop, declared with the
workers(..)macro argument (orWorkers::sequentialby default).
Enums§
- Batch
Result - The settlement of one dispatched batch.
- Failure
Policy - What a subscriber does when it cannot process a message.
- Handler
Result - What the router should do with the message after the handler returns.
- Rust
Stream Error - Errors surfaced while running a
RustStreamservice.
Constants§
- RETRY_
COUNT_ HEADER - Header carrying the framework’s deferred-republish retry count.
Traits§
- App
- The functional surface of a built
RustStreamservice: run it, and read the metadata theAsyncAPIgenerator and the generated CLI need. - Batch
Def - A batch handler definition produced by
#[subscriber(batch(..))]. - Batch
Publish Transform - A static publish transform that runs only on a
#[subscriber(batch(..), publish(..))]handler’s replies, not on single-message replies. - Batch
Publishing Call - Runs a
BatchPublishingDef’s handler body over an app state of typeS. - Batch
Publishing Def - A batch subscriber definition that produces replies to publish.
- Blanket
Layer - A
Layerthat wraps a handler on any message type, not one fixedH. - DynMiddleware
- A middleware in the around / next style, operating on a borrowed input
Iand itsContext. - Erased
Publisher - A publisher with its concrete type and error erased.
- From
Context - A value resolved from the per-delivery
Contextand shared state, ready to be passed to a handler as a parameter. - FromRef
- Produces a value from a reference to the shared application state
S. - Handler
- A handler invoked on each input it is given.
- Handler
Ext - Convenience extension trait for fluent layer stacking on any
Handler. - Into
Batch Result - Conversion into a
BatchResult, so#[subscriber(batch(..))]handlers can return a plain value. - Into
Settle - Conversion into a
Settle, so#[subscriber]handlers can return a plain value instead of always constructing one. - Layer
- A function from one handler to another. Apply with
HandlerExt::with. - Publish
DynLayer - An object-safe publish middleware, for a
PublishDynStack. - Publish
Layer - Middleware that transforms (or observes) an
Outgoingmessage before it is published. - Publish
Pipeline - A static, app-wide publish pipeline: an around-style chain of
PublishLayerending in the broker send. - Publish
Transform - A static, compile-time publish transform: mutates an
Outgoingbefore it is sent, with read access to the originating delivery throughPublishContext. - Publishing
Call - Runs a
PublishingDef’s handler body over an app state of typeS. - Publishing
Def - A subscriber definition that produces a reply to publish.
- Reply
Publisher - The reply wiring accepted by the
include_batch_publishingmounts. - Router
Def - A mountable group of handler registrations.
- Router
Handlers - Metadata collection over a router’s registration list, independent of the app state type.
- Slice
Handler - A handler invoked with one whole decoded batch.
- Subscriber
Def - A handler definition produced by the
#[subscriber]macro.
Functions§
- for_
batch - Lifts a per-message
PublishTransformonto the batch path so the same transform can be added withTypedPublisher::batch_transformwithout a second implementation. - typed
- Build a
Handler<M>that decodes the payload withcodecintoTand forwards&Ttoinner.