#[subscriber]Expand description
Turns an async fn handler into a mountable subscriber definition.
ⓘ
/// Processes incoming orders.
#[subscriber("orders")]
async fn handle(order: &Order) -> HandlerResult { HandlerResult::Ack }
// later: broker_scope.include(handle);
// reply form: the return value is encoded and published to "responses" through the
// TypedPublisher (broker + reply codec) passed at wiring time.
#[subscriber("requests", publish("responses"))]
async fn reply(req: &Request) -> Response { /* ... */ }
// later: broker_scope.include_publishing(reply, typed_publisher);
// reply form with explicit ack control: `Ok` publishes the reply, `Err` skips it and the
// dispatcher acts on the returned HandlerResult.
#[subscriber("requests", publish("responses"))]
async fn confirm(req: &Request) -> Result<Response, HandlerResult> { /* ... */ }Without publish(..) the handler returns any IntoHandlerResult (a HandlerResult, (), or
Result<_, E>). With publish(..) it returns the reply value to publish, or
Result<Reply, HandlerResult> to control acknowledgement: Err(result) publishes nothing and
returns result to the dispatcher. The Result form is detected syntactically, so spell it
out in the signature (a type alias is treated as a plain reply type).
In both forms the handler may declare an optional second parameter, the per-delivery
&mut Context, to read app state or publish manually.