Expand description
Application object, middleware and dispatch.
Modules§
- cli
- The process entry point generated by
#[ruststream::app]. - forms
- Form tokens for
IncludeDef: which mounting machinery a definition uses. - 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
Inject Handler - The batch handler built from a
BatchInjectDefonce its injections resolved: decode the batch, run the body with them, settle every delivery. - 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. - Bindable
- A broker wrapped for token minting before registration.
- Bound
- A publisher source bound to a concrete broker instance, minted by
Bindable::bind. - Broker
Scope - A handler-registration scope bound to one broker.
- Context
- Per-delivery context, threaded through middleware and into the handler.
- Ctx
- Extractor that injects one broker context field into a handler, by its key.
- Decoded
- The typed input kind: the payload decodes into an owned
T, the handler borrows&T. - 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.
- Health
Probe - A cheap, cloneable handle reporting the service’s
HealthState. - Identity
- The identity
Layer: returns the handler unchanged. The default global stack onRustStream. - Include
With - A registration builder over one attachment, generic over its mount token.
- Include
With Out - A registration builder with two attachments, for a publishing handler that also takes an
Outparameter. - Inject
Handler - The
Handlerbuilt from anInjectDefonce its injections resolved: decode, then run the body with them. - Next
- A cursor over the remaining middleware in a
DynStack, ending in the wrapped handler. - Out
- The marker a handler signature uses to receive an injected publisher:
Out(out): Out<P>bindsoutto&Pinside the body. - 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, deliver the reply, ack. - RawBytes
- The raw input kind: nothing decodes, the handler borrows the payload bytes as delivered.
- 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.
- Running
App - A started service, handed out by
RustStream::start. - Rust
Stream - The top-level application object.
- Seek
- The marker a handler signature uses to receive its subscription’s seeker:
Seek(seeker): Seek<K>bindsseekerto&Kinside the body. - Settle
- The settlement of one dispatched message: the
HandlerResultoutcome the dispatcher acts on, plus an optional post-settle continuation. - Setup
RustStreamphase marker: the builder is still being configured - the state type, the middleware stack, and the publish pipeline may change, and no broker is registered yet.- 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.
- Transaction
Scope - A live broker transaction, opened by
Transactional::begin. - Transactional
- A
TypedPublisherwhose batch replies are published inside one broker transaction. - Typed
- Handler produced by
typed(orTyped::overfor a non-decoding input kind). Override the decode-failure policy withTyped::on_decode_failure. - Typed
Batch - The decode adapter for batches, the
Typedcounterpart, generic over the element’s input kind. - Typed
Publisher - A byte
Publisherpaired with aCodecand a staticPublishTransformstack, ready to send typed values. - Typed
Transaction - An owned broker transaction carrying the publisher’s codec, opened by
TypedPublisher::transaction. - Wired
RustStreamphase marker: at least one broker (with its handlers) is registered, so the state type, the middleware stack, and the publish pipeline are fixed.- 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.
- Health
State - The lifecycle state reported by a
HealthProbe. - Rust
Stream Error - Errors surfaced while running a
RustStreamservice. - Transaction
Publish Error - Error returned by
TransactionScope::publish.
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
Inject Call - Runs a
BatchInjectDef’s handler body over an app state of typeS. - Batch
Inject Def - A batch definition whose handler takes startup-injected parameters.
- 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. - Broker
Registration - What the
with_brokerfamily accepts. - Decode
With - An
InputKindthat knows how to decode itself with the codecC. - 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. - From
Startup - A handler parameter resolved once per subscription at startup.
- Handler
- A handler invoked on each input it is given.
- Handler
Ext - Convenience extension trait for fluent layer stacking on any
Handler. - Include
Def - Ties a definition type to its form token.
- Inject
Call - Runs an
InjectDef’s handler body over an app state of typeS(the same state-generic shape asHandler; seePublishingCallfor the rationale). - Inject
Def - A subscriber definition whose handler takes startup-injected parameters.
- Input
Kind - One kind of handler input: the owned decode product and the borrowed view lent to the 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. - Reply
Sink - The reply-wiring axis: how a handler’s reply value leaves the service.
- Reply
Wiring - The decode-codec view of a reply wiring, readable before pairing.
- 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 (with or withoutraw).
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.
Type Aliases§
- Include
Batch Out - The builder
BrokerScope::include_batchreturns for a batch handler with anOutparameter. - Include
Batch Publishing - The builder
BrokerScope::include_batchreturns for abatch(.., publish("dest"))definition. - Include
Batch Publishing Out - The builder
BrokerScope::include_batchreturns for abatch(.., publish("dest"))definition whose handler also takes anOutparameter. - Include
Out - The builder
BrokerScope::includereturns for a handler with anOutparameter: the attachment is the parameter’s publish policy, with no default. - Include
Publishing - The builder
BrokerScope::includereturns for apublish("dest")definition: the attachment is the reply source, defaulting to the broker’s default publish policy under the default codec. - Include
Publishing Out - The builder
BrokerScope::includereturns for apublish("dest")/publish_raw("dest")definition whose handler also takes anOutparameter.