From 6f144e91310dcc7bd37aba4e8aebd535d13fa31a Mon Sep 17 00:00:00 2001 From: Sean Feldman Date: Thu, 26 Jul 2018 13:06:38 -0600 Subject: [PATCH] Fixes #534 (#536) Fixes #534 - batching disposition is always set to true with async operations. --- .../Amqp/AmqpMessageConverter.cs | 6 +++--- src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs b/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs index 6c8b2c1b..27e32d6d 100644 --- a/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs +++ b/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs @@ -32,7 +32,7 @@ static class AmqpMessageConverter const string DateTimeOffsetName = AmqpConstants.Vendor + ":datetime-offset"; const int GuidSize = 16; - public static AmqpMessage BatchSBMessagesAsAmqpMessage(IEnumerable sbMessages, bool batchable) + public static AmqpMessage BatchSBMessagesAsAmqpMessage(IEnumerable sbMessages) { if (sbMessages == null) { @@ -66,7 +66,7 @@ public static AmqpMessage BatchSBMessagesAsAmqpMessage(IEnumerable sb if (messageCount == 1 && firstAmqpMessage != null) { - firstAmqpMessage.Batchable = batchable; + firstAmqpMessage.Batchable = true; return firstAmqpMessage; } @@ -94,7 +94,7 @@ public static AmqpMessage BatchSBMessagesAsAmqpMessage(IEnumerable sb firstMessage.ViaPartitionKey; } - amqpMessage.Batchable = batchable; + amqpMessage.Batchable = true; return amqpMessage; } diff --git a/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs b/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs index 7cae26c2..d0257ee9 100644 --- a/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs +++ b/src/Microsoft.Azure.ServiceBus/Core/MessageSender.cs @@ -92,7 +92,7 @@ public MessageSender( TransportType transportType = TransportType.Amqp, RetryPolicy retryPolicy = null) : this(entityPath, null, null, new ServiceBusConnection(endpoint, transportType, retryPolicy) {TokenProvider = tokenProvider}, null, retryPolicy) - { + { this.OwnsConnection = true; } @@ -119,9 +119,9 @@ public MessageSender( /// The first destination of the message. /// The that will be used when communicating with Service Bus. Defaults to /// - /// This is mainly to be used when sending messages in a transaction. + /// This is mainly to be used when sending messages in a transaction. /// When messages need to be sent across entities in a single transaction, this can be used to ensure - /// all the messages land initially in the same entity/partition for local transactions, and then + /// all the messages land initially in the same entity/partition for local transactions, and then /// let service bus handle transferring the message to the actual destination. /// public MessageSender( @@ -524,7 +524,7 @@ async Task> ProcessMessages(IList messageList) async Task OnSendAsync(IList messageList) { var timeoutHelper = new TimeoutHelper(this.OperationTimeout, true); - using (var amqpMessage = AmqpMessageConverter.BatchSBMessagesAsAmqpMessage(messageList, true)) + using (var amqpMessage = AmqpMessageConverter.BatchSBMessagesAsAmqpMessage(messageList)) { SendingAmqpLink amqpLink = null; try