Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If you have determined that an exception should move messages to the error queue (no retry), then simply throw an exception from the ProcessMessagesAsync method.

Info
Note that in both uses of batching (All or None, Partial Success), you must mark each IMessageContext object within the batch as successful. This is done by calling IMessageBatchContext.MarkSuccessfullyProcessedForThisDevice(IMessageContext). An extension method exists to allow you to call this for each context within a batch.


Code Block
// When an exception is thrown (or bubbles up), all messages in the batch will be moved to the error queue
public async Task ProcessMessagesAsync(IMessageBatchContext batch, CancellationToken cancellationToken)
{
    // All messages within the batch will be moved to the error queue.
    // Each message processing history will contain the exception thrown.
    throw new DivideByZeroException("Logic error!");
}

...