Expand description
Zero-sized Field keys reading one AmqpContext field each.
A handler names the fields it needs one key at a time, through Ctx<..>; the prelude carries
the four keys.
§Examples
use ruststream_lapin::prelude::*;
use serde::Deserialize;
#[derive(Deserialize)]
struct Order {
id: u64,
}
#[subscriber(RabbitQueue::new("orders-audit"))]
async fn audit(
order: &Order,
Ctx(routing_key): Ctx<RoutingKey>,
Ctx(redelivered): Ctx<Redelivered>,
) -> HandlerOutcome {
tracing::info!(order.id, routing_key, redelivered, "audited");
HandlerOutcome::ack()
}
fn app() -> RustStream {
let broker = LapinBroker::new("amqp://localhost:5672");
RustStream::new(AppInfo::new("audit", "0.1.0")).with_broker(broker, |b| {
b.include(audit);
})
}Structs§
- Delivery
Tag - Reads the channel-local delivery tag.
- Exchange
- Reads the source exchange name.
- Redelivered
- Reads the redelivered flag.
- Routing
Key - Reads the routing key.