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