Перейти к основному содержимому
Эта страница ещё не переведена

Ниже показан английский оригинал.

SqsSubscription

SqsSubscription puts the queue steps on the mount chain, after the framework's own steps such as batch(n) and name.

The steps are those of SqsQueue: wait, visibility and create_if_missing. They chain after a framework step: a batch size, a name for a definition that fixed only the kind, or workers(n). A step at the mount site changes the descriptor the attribute built, so it wins over the attribute's value. The steps exist only on the chain of a subscription whose source is an SqsQueue, so they never reach another broker's subscription. The trait comes with the crate's prelude. In the manual form the steps follow map_source or name.

Example​

Ten orders per receive, a 20 second long poll, and a queue the service creates.

fn service(broker: SqsBroker) -> impl App<State = ()> {
RustStream::new(AppInfo::new("orders-batches", "0.1.0")).with_broker(broker, |b| {
// The size is the framework's word and becomes `MaxNumberOfMessages`; the long
// poll and the queue's provisioning are this crate's, chained after it.
b.include(
reconcile
.batch(nonzero!(10))
.wait(Duration::from_secs(20))
.create_if_missing(),
);
})
}