From f6dbac52084b2ba11aeff1fbf4c1924b21045458 Mon Sep 17 00:00:00 2001 From: Paul Reardon Date: Mon, 25 Oct 2021 13:35:54 +0100 Subject: [PATCH] Updated External Bus to not attempt to send MT_NONE (#1789) --- src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs | 4 ++-- src/Paramore.Brighter/ExternalBusServices.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs b/src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs index bbdfa8ad9c..35e9c6750a 100644 --- a/src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs +++ b/src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs @@ -690,7 +690,7 @@ private Message MapFunction(SqlDataReader dr) } dr.Close(); - return message; + return message ?? new Message(); } private async Task MapFunctionAsync(SqlDataReader dr) @@ -702,7 +702,7 @@ private async Task MapFunctionAsync(SqlDataReader dr) } dr.Close(); - return message; + return message ?? new Message(); } } } diff --git a/src/Paramore.Brighter/ExternalBusServices.cs b/src/Paramore.Brighter/ExternalBusServices.cs index e2aea9d3e4..040ee1d596 100644 --- a/src/Paramore.Brighter/ExternalBusServices.cs +++ b/src/Paramore.Brighter/ExternalBusServices.cs @@ -137,7 +137,7 @@ internal void ClearOutbox(params Guid[] posts) foreach (var messageId in posts) { var message = OutBox.Get(messageId); - if (message == null) + if (message == null || message.Header.MessageType == MessageType.MT_NONE) throw new NullReferenceException($"Message with Id {messageId} not found in the Outbox"); s_logger.LogInformation("Decoupled invocation of message: Topic:{Topic} Id:{Id}", message.Header.Topic, messageId.ToString()); @@ -173,7 +173,7 @@ internal async Task ClearOutboxAsync(IEnumerable posts, bool continueOnCap foreach (var messageId in posts) { var message = await AsyncOutbox.GetAsync(messageId, OutboxTimeout, cancellationToken); - if (message == null) + if (message == null || message.Header.MessageType == MessageType.MT_NONE) throw new NullReferenceException($"Message with Id {messageId} not found in the Outbox"); s_logger.LogInformation("Decoupled invocation of message: Topic:{Topic} Id:{Id}", message.Header.Topic, messageId.ToString());