From cbd8de31507266dc9207ed75dafcc13ff8326349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20J=C3=B6nsson?= Date: Sun, 29 Sep 2024 18:42:02 +0200 Subject: [PATCH 1/2] Map Subject property on ServiceBusReceivedMessage creation --- .../Internals/MessagesStore.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs b/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs index 1f73f05..977730c 100644 --- a/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs +++ b/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs @@ -232,8 +232,6 @@ private ServiceBusReceivedMessage FinishReceiveMessageUnsafe(EnqueuedServiceBusM throw new InvalidOperationException($"Unsupported receive mode: {receiveMode}."); } - - return ServiceBusModelFactory.ServiceBusReceivedMessage( body: message.Body, messageId: message.MessageId, @@ -244,11 +242,11 @@ private ServiceBusReceivedMessage FinishReceiveMessageUnsafe(EnqueuedServiceBusM contentType: message.ContentType, enqueuedTime: timeProvider.GetUtcNow(), properties: message.ApplicationProperties, + subject: message.Subject, lockTokenGuid: lockToken, lockedUntil: lockedUntil, sequenceNumber: sequenceNumber ); - } private void ReleaseExpiredMessagesUnsafe() From 1978fe07453cfda50ec27080ee8a3deeda16bc64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20J=C3=B6nsson?= Date: Mon, 30 Sep 2024 10:29:33 +0200 Subject: [PATCH 2/2] Map PartitionKey and ReplyTo --- .../Internals/MessagesStore.cs | 4 +++- tests/Tests/ServiceBus/ServiceBusReceiverTests.cs | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs b/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs index 977730c..4e170bc 100644 --- a/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs +++ b/src/Spotflow.InMemory.Azure.ServiceBus/Internals/MessagesStore.cs @@ -237,6 +237,7 @@ private ServiceBusReceivedMessage FinishReceiveMessageUnsafe(EnqueuedServiceBusM messageId: message.MessageId, sessionId: message.SessionId, replyToSessionId: message.ReplyToSessionId, + replyTo: message.ReplyTo, timeToLive: message.TimeToLive, correlationId: message.CorrelationId, contentType: message.ContentType, @@ -245,7 +246,8 @@ private ServiceBusReceivedMessage FinishReceiveMessageUnsafe(EnqueuedServiceBusM subject: message.Subject, lockTokenGuid: lockToken, lockedUntil: lockedUntil, - sequenceNumber: sequenceNumber + sequenceNumber: sequenceNumber, + partitionKey: message.PartitionKey ); } diff --git a/tests/Tests/ServiceBus/ServiceBusReceiverTests.cs b/tests/Tests/ServiceBus/ServiceBusReceiverTests.cs index 80316c9..7536575 100644 --- a/tests/Tests/ServiceBus/ServiceBusReceiverTests.cs +++ b/tests/Tests/ServiceBus/ServiceBusReceiverTests.cs @@ -303,12 +303,12 @@ public async Task Received_Message_Should_Have_All_Expected_Properties() receivedMessage.ApplicationProperties.Count.Should().Be(1); receivedMessage.ApplicationProperties["test-app-property"].Should().Be("test-app-property-value"); - //receivedMessage.Subject.Should().Be("test-subject"); + receivedMessage.Subject.Should().Be("test-subject"); receivedMessage.ContentType.Should().Be("test-content-type"); receivedMessage.CorrelationId.Should().Be("test-correlation-id"); receivedMessage.MessageId.Should().Be("test-message-id"); - //receivedMessage.PartitionKey.Should().Be("test-partition-key"); - //receivedMessage.ReplyTo.Should().Be("test-reply-to"); + receivedMessage.PartitionKey.Should().Be("test-partition-key"); + receivedMessage.ReplyTo.Should().Be("test-reply-to"); receivedMessage.ReplyToSessionId.Should().Be("test-reply-to-session-id"); receivedMessage.EnqueuedTime.Should().Be(timeProvider.GetUtcNow());