< Summary

Class:Azure.Messaging.ServiceBus.Amqp.ManagementUtilities
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Amqp\ManagementUtilities.cs
Covered lines:0
Uncovered lines:17
Coverable lines:17
Total lines:59
Line coverage:0% (0 of 17)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ExecuteRequestResponseAsync()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Amqp\ManagementUtilities.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.Text;
 7using System.Threading.Tasks;
 8using System.Transactions;
 9using Microsoft.Azure.Amqp;
 10
 11namespace Azure.Messaging.ServiceBus.Amqp
 12{
 13    /// <summary>
 14    /// Utility methods related to the management link
 15    /// </summary>
 16    internal static class ManagementUtilities
 17    {
 18        /// <summary>
 19        ///
 20        /// </summary>
 21        /// <param name="connectionScope"></param>
 22        /// <param name="managementLink"></param>
 23        /// <param name="amqpRequestMessage"></param>
 24        /// <param name="timeout"></param>
 25        /// <returns></returns>
 26        internal static async Task<AmqpResponseMessage> ExecuteRequestResponseAsync(
 27           AmqpConnectionScope connectionScope,
 28           FaultTolerantAmqpObject<RequestResponseAmqpLink> managementLink,
 29           AmqpRequestMessage amqpRequestMessage,
 30           TimeSpan timeout)
 31        {
 032            AmqpMessage amqpMessage = amqpRequestMessage.AmqpMessage;
 33
 034            ArraySegment<byte> transactionId = AmqpConstants.NullBinary;
 035            var ambientTransaction = Transaction.Current;
 036            if (ambientTransaction != null)
 37            {
 038                transactionId = await AmqpTransactionManager.Instance.EnlistAsync(
 039                    ambientTransaction,
 040                    connectionScope,
 041                    timeout)
 042                    .ConfigureAwait(false);
 43            }
 44
 045            if (!managementLink.TryGetOpenedObject(out var requestResponseAmqpLink))
 46            {
 47                // MessagingEventSource.Log.CreatingNewLink(this.ClientId, this.isSessionReceiver, this.SessionIdInterna
 048                requestResponseAmqpLink = await managementLink.GetOrCreateAsync(timeout).ConfigureAwait(false);
 49            }
 50
 051            var responseAmqpMessage = await Task.Factory.FromAsync(
 052                (c, s) => requestResponseAmqpLink.BeginRequest(amqpMessage, transactionId, timeout, c, s),
 053                (a) => requestResponseAmqpLink.EndRequest(a),
 054                null).ConfigureAwait(false);
 55
 056            return AmqpResponseMessage.CreateResponse(responseAmqpMessage);
 057        }
 58    }
 59}

Methods/Properties

ExecuteRequestResponseAsync()