Эта страница ещё не переведена
Ниже показан английский оригинал.
describe
.describe(text) gives a manual registration the operation description the attribute takes from the handler's doc comment.
describe is a step of the subscriber(..) chain, before .build(); after .reply() it is still available.
The text becomes the description of the registration's receive operation.
A message's description comes from its own type.
A message whose type has no description takes the handler's.
On the attribute path the doc comment of the handler function is the description, and the step has no use.
The example runs with cargo test --example asyncapi_generation --features macros,memory,asyncapi.
Example
- Macros
- Manual
/// Accepts every order placed in the shop.
#[subscriber("orders")]
async fn accept(order: &Order) -> HandlerOutcome {
tracing::info!(order.id, item = %order.item, "accepted");
HandlerOutcome::ack()
}
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(MemoryBroker::new(), |b| {
b.include(
subscriber("orders", Accept)
.describe("Accepts every order placed in the shop.")
.build(),
);
})
}