diff --git a/src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs b/src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs index 3a4818a..79fe564 100644 --- a/src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs +++ b/src/Microsoft.Azure.ServiceBus/Core/MessageReceiver.cs @@ -1141,6 +1141,10 @@ namespace Microsoft.Azure.ServiceBus.Core } amqpRequestMessage.Map[ManagementConstants.Properties.SequenceNumbers] = sequenceNumbers; amqpRequestMessage.Map[ManagementConstants.Properties.ReceiverSettleMode] = (uint)(this.ReceiveMode == ReceiveMode.ReceiveAndDelete ? 0 : 1); + if (!string.IsNullOrWhiteSpace(this.SessionIdInternal)) + { + amqpRequestMessage.Map[ManagementConstants.Properties.SessionId] = this.SessionIdInternal; + } var response = await this.ExecuteRequestResponseAsync(amqpRequestMessage).ConfigureAwait(false); diff --git a/src/Microsoft.Azure.ServiceBus/TransportType.cs b/src/Microsoft.Azure.ServiceBus/TransportType.cs index 3c78a77..0252533 100644 --- a/src/Microsoft.Azure.ServiceBus/TransportType.cs +++ b/src/Microsoft.Azure.ServiceBus/TransportType.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.ServiceBus /// Uses AMQP over WebSockets /// /// This runs on port 443 with wss URI scheme. This could be used in scenarios where traffic to port 5671 is blocked. - /// To setup a proxy connection, please configure system default proxy. Proxy currently is supported only in net451+ framework. + /// To setup a proxy connection, please configure system default proxy. Proxy currently is supported only in .NET 4.5.1 and higher or .NET Core 2.1 and higher. AmqpWebSockets = 1 } } diff --git a/test/Microsoft.Azure.ServiceBus.UnitTests/QueueSessionTests.cs b/test/Microsoft.Azure.ServiceBus.UnitTests/QueueSessionTests.cs index 4d03b04..38eb9af 100644 --- a/test/Microsoft.Azure.ServiceBus.UnitTests/QueueSessionTests.cs +++ b/test/Microsoft.Azure.ServiceBus.UnitTests/QueueSessionTests.cs @@ -203,6 +203,32 @@ namespace Microsoft.Azure.ServiceBus.UnitTests } } + [Theory] + [MemberData(nameof(TestPermutations))] + [DisplayTestMethodName] + public async Task ReceiveDeferredMessageForSessionTest(string qName) + { + var sessionId = Guid.NewGuid().ToString("N").Substring(0, 8); + var messageId = Guid.NewGuid().ToString("N").Substring(0, 8); + + var sender = new MessageSender(TestUtility.NamespaceConnectionString, qName); + await sender.SendAsync(new Message() { SessionId = sessionId, MessageId = messageId }); + + var sessionClient = new SessionClient(TestUtility.NamespaceConnectionString, qName); + var messageSession = await sessionClient.AcceptMessageSessionAsync(sessionId); + var msg = await messageSession.ReceiveAsync(); + var seqNum = msg.SystemProperties.SequenceNumber; + await messageSession.DeferAsync(msg.SystemProperties.LockToken); + var msg2 = await messageSession.ReceiveDeferredMessageAsync(seqNum); + + Assert.Equal(seqNum, msg2.SystemProperties.SequenceNumber); + Assert.Equal(messageId, msg2.MessageId); + + await sender.CloseAsync(); + await sessionClient.CloseAsync(); + await messageSession.CloseAsync(); + } + [Fact] [DisplayTestMethodName] public async Task AcceptSessionThrowsSessionCannotBeLockedException()