Skip to main content

SNS topics

A fan-out position reports its topic through an sns binding, with a FIFO ordering object on a .fifo topic.

A channel the service publishes to through SnsPublish carries the sns binding instead of the sqs one. name is the topic the mount site resolved, from a reply clause, a reply type's #[outgoing(name)] or a slot entry. A topic whose name ends in .fifo adds ordering, with type set to FIFO. Its contentBasedDeduplication is false: every FIFO send this crate makes carries a deduplication id of its own, which wins over one derived from the body. A standard topic carries no ordering object, which the specification reads as a standard topic.

Example​

The reply of settle fans out from the FIFO topic payment-events.fifo.

/// The reply names a FIFO topic.
#[subscriber(SqsQueue::new("payments"), reply("payment-events.fifo"))]
async fn settle(payment: &Payment) -> PaymentSettled {
PaymentSettled { id: payment.id }
}

fn service(broker: SqsBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders", "1.0.0")).with_broker_labeled("sqs", broker, |b| {
b.include(confirm);
b.include(ship);
// The reply fans out from the topic its clause names.
b.include(settle).out_reply(SnsPublish::default());
})
}

The binding of payment-events.fifo in the document:

{
"sns": {
"bindingVersion": "1.0.0",
"name": "payment-events.fifo",
"ordering": {
"type": "FIFO",
"contentBasedDeduplication": false
}
}
}