< Summary

Class:Azure.Messaging.ServiceBus.ProcessMessageEventArgs
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Processor\ProcessMessageEventArgs.cs
Covered lines:37
Uncovered lines:2
Coverable lines:39
Total lines:141
Line coverage:94.8% (37 of 39)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Message()-0%100%
get_CancellationToken()-0%100%
.ctor(...)-100%100%
AbandonMessageAsync()-100%100%
CompleteMessageAsync()-100%100%
DeadLetterMessageAsync()-100%100%
DeadLetterMessageAsync()-100%100%
DeferMessageAsync()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Processor\ProcessMessageEventArgs.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Threading;
 7using System.Threading.Tasks;
 8
 9namespace Azure.Messaging.ServiceBus
 10{
 11    /// <summary>
 12    /// The <see cref="ProcessMessageEventArgs"/> contain event args that are specific
 13    /// to the <see cref="ServiceBusReceivedMessage"/> that is being processed.
 14    /// </summary>
 15    public class ProcessMessageEventArgs : EventArgs
 16    {
 17
 18        /// <summary>
 19        /// The received message to be processed.
 20        /// </summary>
 021        public ServiceBusReceivedMessage Message { get; }
 22
 23        /// <summary>
 24        /// A <see cref="System.Threading.CancellationToken"/> instance to signal the request to cancel the operation.
 25        /// </summary>
 026        public CancellationToken CancellationToken { get; }
 27
 28        private readonly ServiceBusReceiver _receiver;
 29
 30        /// <summary>
 31        /// Initializes a new instance of the <see cref="ProcessMessageEventArgs"/> class.
 32        /// </summary>
 33        ///
 34        /// <param name="message"></param>
 35        /// <param name="receiver"></param>
 36        /// <param name="cancellationToken"></param>
 837        internal ProcessMessageEventArgs(ServiceBusReceivedMessage message, ServiceBusReceiver receiver, CancellationTok
 38        {
 839            Message = message;
 840            _receiver = receiver;
 841            CancellationToken = cancellationToken;
 842        }
 43
 44        /// <summary>
 45        ///
 46        /// </summary>
 47        /// <param name="message"></param>
 48        /// <param name="propertiesToModify"></param>
 49        /// <param name="cancellationToken"></param>
 50        /// <returns></returns>
 51        public async Task AbandonMessageAsync(
 52            ServiceBusReceivedMessage message,
 53            IDictionary<string, object> propertiesToModify = default,
 54            CancellationToken cancellationToken = default)
 55        {
 456            await _receiver.AbandonMessageAsync(message, propertiesToModify, cancellationToken)
 457            .ConfigureAwait(false);
 258            message.IsSettled = true;
 259        }
 60
 61        /// <summary>
 62        ///
 63        /// </summary>
 64        /// <param name="message"></param>
 65        /// <param name="cancellationToken"></param>
 66        /// <returns></returns>
 67        public async Task CompleteMessageAsync(
 68            ServiceBusReceivedMessage message,
 69            CancellationToken cancellationToken = default)
 70        {
 471            await _receiver.CompleteMessageAsync(
 472                message,
 473                cancellationToken)
 474            .ConfigureAwait(false);
 275            message.IsSettled = true;
 276        }
 77
 78        /// <summary>
 79        ///
 80        /// </summary>
 81        /// <param name="message"></param>
 82        /// <param name="deadLetterReason"></param>
 83        /// <param name="deadLetterErrorDescription"></param>
 84        /// <param name="cancellationToken"></param>
 85        /// <returns></returns>
 86        public async Task DeadLetterMessageAsync(
 87            ServiceBusReceivedMessage message,
 88            string deadLetterReason,
 89            string deadLetterErrorDescription = default,
 90            CancellationToken cancellationToken = default)
 91        {
 492            await _receiver.DeadLetterMessageAsync(
 493                message,
 494                deadLetterReason,
 495                deadLetterErrorDescription,
 496                cancellationToken)
 497            .ConfigureAwait(false);
 298            message.IsSettled = true;
 299        }
 100
 101        /// <summary>
 102        ///
 103        /// </summary>
 104        /// <param name="message"></param>
 105        /// <param name="propertiesToModify"></param>
 106        /// <param name="cancellationToken"></param>
 107        /// <returns></returns>
 108        public async Task DeadLetterMessageAsync(
 109            ServiceBusReceivedMessage message,
 110            IDictionary<string, object> propertiesToModify = default,
 111            CancellationToken cancellationToken = default)
 112        {
 4113            await _receiver.DeadLetterMessageAsync(
 4114                message,
 4115                propertiesToModify,
 4116                cancellationToken)
 4117            .ConfigureAwait(false);
 2118            message.IsSettled = true;
 2119        }
 120
 121        /// <summary>
 122        ///
 123        /// </summary>
 124        /// <param name="message"></param>
 125        /// <param name="propertiesToModify"></param>
 126        /// <param name="cancellationToken"></param>
 127        /// <returns></returns>
 128        public async Task DeferMessageAsync(
 129            ServiceBusReceivedMessage message,
 130            IDictionary<string, object> propertiesToModify = default,
 131            CancellationToken cancellationToken = default)
 132        {
 4133            await _receiver.DeferMessageAsync(
 4134                message,
 4135                propertiesToModify,
 4136                cancellationToken)
 4137            .ConfigureAwait(false);
 2138            message.IsSettled = true;
 2139        }
 140    }
 141}