Table of Contents

Interface IContext

Namespace
RabbitMQ.AMQP.Client
Assembly
RabbitMQ.AMQP.Client.dll
public interface IContext

Methods

Accept()

Accept the message (AMQP 1.0 accepted outcome).

This means the message has been processed and the broker can delete it.

void Accept()

Batch()

Create a batch context to accumulate message contexts and settle them at once. The message context the batch context is created from is not added to the batch context. @return the created batch context

IBatchContext Batch()

Returns

IBatchContext

DelayedRetry(TimeSpan, bool)

Requeue the message with an explicit per-message delivery delay (AMQP 1.0 modified{delivery-failed = true/false, undeliverable-here = false} outcome), overriding the queue-level back-off for this specific delivery.

The delay is sent to the broker as the x-opt-delivery-time message annotation (absolute Unix timestamp in milliseconds = DateTimeOffset.UtcNow + delay).

Requires the queue to be configured with x-delayed-retry-type (or all) and RabbitMQ 4.3 or later.

How long from now the broker should wait before redelivering. sets the deliveryFailed in link.Modify(..) function. When true: RabbitMQ considers it as failed. Delivery Count will be increased. This method is a helper, It is like Requeue with annotations, but it adds the x-opt-delivery-time annotation for you based on the delay parameter.
void DelayedRetry(TimeSpan delay, bool deliveryFailed = false)

Parameters

delay TimeSpan
deliveryFailed bool

Discard()

Discard the message (AMQP 1.0 rejected outcome).

This means the message cannot be processed because it is invalid, the broker can drop it or dead-letter it if it is configured.

void Discard()

Discard(Dictionary<string, object>)

Discard the message with annotations to combine with the existing message annotations.

This means the message cannot be processed because it is invalid, the broker can drop it or dead-letter it if it is configured.

Application-specific annotation keys must start with the x-opt- prefix.

Annotation keys that the broker understands start with x-, but not with x-opt-. This maps to the AMQP 1.0 modified{delivery-failed = false, undeliverable-here = false} outcome.

The annotations can be used only with Quorum queues, see AMQP 1.0 modified outcome.

Message annotations to combine with existing ones.
void Discard(Dictionary<string, object> annotations)

Parameters

annotations Dictionary<string, object>

Requeue()

Requeue the message (AMQP 1.0 
released

outcome).

This means the message has not been processed and the broker can requeue it and deliver it
 to the same or a different consumer.
void Requeue()

Requeue(Dictionary<string, object>, bool)

Requeue the message with annotations to combine with the existing message annotations.

This means the message has not been processed and the broker can requeue it and deliver it to the same or a different consumer.

Application-specific annotation keys must start with the x-opt- prefix.

Annotation keys that the broker understands start with x-, but not with x-opt-. This maps to the AMQP 1.0 modified{delivery-failed = false, undeliverable-here = false} outcome.

The annotations can be used only with Quorum queues, see AMQP 1.0 modified outcome.

Message annotations to combine with existing ones. sets the deliveryFailed in link.Modify(..) function. When true: RabbitMQ considers it as failed. Delivery Count will be increased.
void Requeue(Dictionary<string, object> annotations, bool deliveryFailed = false)

Parameters

annotations Dictionary<string, object>
deliveryFailed bool