| | | 1 | | // Copyright (c) Microsoft. All rights reserved. |
| | | 2 | | // Licensed under the MIT license. See LICENSE file in the project root for full license information. |
| | | 3 | | |
| | | 4 | | namespace Microsoft.Azure.ServiceBus.Amqp |
| | | 5 | | { |
| | | 6 | | using System; |
| | | 7 | | using Azure.Amqp; |
| | | 8 | | using Azure.Amqp.Encoding; |
| | | 9 | | using Azure.Amqp.Framing; |
| | | 10 | | |
| | | 11 | | internal sealed class AmqpRequestMessage |
| | | 12 | | { |
| | | 13 | | readonly AmqpMessage requestMessage; |
| | | 14 | | |
| | 0 | 15 | | AmqpRequestMessage(string operation, TimeSpan timeout, string trackingId) |
| | | 16 | | { |
| | 0 | 17 | | this.Map = new AmqpMap(); |
| | 0 | 18 | | this.requestMessage = AmqpMessage.Create(new AmqpValue { Value = this.Map }); |
| | 0 | 19 | | this.requestMessage.ApplicationProperties.Map[ManagementConstants.Request.Operation] = operation; |
| | 0 | 20 | | this.requestMessage.ApplicationProperties.Map[ManagementConstants.Properties.ServerTimeout] = (uint)timeout. |
| | 0 | 21 | | this.requestMessage.ApplicationProperties.Map[ManagementConstants.Properties.TrackingId] = trackingId ?? Gui |
| | 0 | 22 | | } |
| | | 23 | | |
| | 0 | 24 | | public AmqpMessage AmqpMessage => this.requestMessage; |
| | | 25 | | |
| | 0 | 26 | | public AmqpMap Map { get; } |
| | | 27 | | |
| | | 28 | | public static AmqpRequestMessage CreateRequest(string operation, TimeSpan timeout, string trackingId) |
| | | 29 | | { |
| | 0 | 30 | | return new AmqpRequestMessage(operation, timeout, trackingId); |
| | | 31 | | } |
| | | 32 | | } |
| | | 33 | | } |