pub struct Worker { /* private fields */ }Implementations§
Source§impl Worker
impl Worker
Sourcepub async fn connect(dsn: &str, queue: &str) -> Result<Self>
pub async fn connect(dsn: &str, queue: &str) -> Result<Self>
Connect with the nats://[user:password@]host[:port] DSN Broker\Nats takes (its query
configures provisioning and is not read here) and join queue.
Sourcepub async fn join(js: Context, queue: &str) -> Result<Self>
pub async fn join(js: Context, queue: &str) -> Result<Self>
Join queue on an existing JetStream context.
Sourcepub async fn receive(
&self,
max: usize,
expires: Duration,
) -> Result<Vec<Delivery>>
pub async fn receive( &self, max: usize, expires: Duration, ) -> Result<Vec<Delivery>>
Up to max messages, waiting at most expires for the first.
The rest are only what arrives within a short top-up, as in Broker\Nats::pull(): a
batch the consumer’s maxAckPending will not let fill would otherwise hold the first
messages, unextended, for all of expires.
A message no worker could read, or one on its spare delivery, is dead-lettered here and
not returned, as Broker\Nats parks it.
Sourcepub async fn reject(&self, delivery: Delivery, terminal: bool) -> Result<()>
pub async fn reject(&self, delivery: Delivery, terminal: bool) -> Result<()>
The message failed. It comes back after the queue’s backoff or, on its last attempt or
when terminal, goes to the dead stream, where PHP’s retry() can requeue it.
Auto Trait Implementations§
impl !RefUnwindSafe for Worker
impl !UnwindSafe for Worker
impl Forget for Worker
impl Freeze for Worker
impl Move for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl UnsafeUnpin for Worker
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more