Skip to main content

Operations

A receive operation reports its consumer under x-ruststream-pulsar: the subscription, its type, the ack timeout, topics or pattern.

The extension carries what a reader of the document most wants to know about a consumer:

FieldValue
subscriptionthe durable subscription the consumer joins
subscriptionTypeExclusive, Shared, Failover or KeyShared
ackTimeoutMillisthe ack timeout, when the descriptor sets one
topicsevery topic of a topics subscription
topicPatternthe regular expression of a pattern subscription

The values come from the descriptor alone, before the broker connects. A subscription by bare topic name has no descriptor, so its operation carries no extension.

Example​

The operation receive_persistent___acme_orders_created reports the subscription confirmations, of the default type Shared, with a 30-second ack timeout.

#[subscriber(
PulsarSubscription::new("persistent://acme/orders/created", "confirmations")
.ack_timeout(Duration::from_secs(30)),
reply("persistent://acme/orders/confirmed")
)]
async fn confirm(order: &Order) -> Confirmation {
Confirmation { id: order.id }
}