Skip to content

Commit

Permalink
Updated External Bus to not attempt to send MT_NONE (#1789)
Browse files Browse the repository at this point in the history
  • Loading branch information
preardon authored Oct 25, 2021
1 parent 6bfaf2b commit f6dbac5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Paramore.Brighter.Outbox.MsSql/MsSqlOutbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ private Message MapFunction(SqlDataReader dr)
}
dr.Close();

return message;
return message ?? new Message();
}

private async Task<Message> MapFunctionAsync(SqlDataReader dr)
Expand All @@ -702,7 +702,7 @@ private async Task<Message> MapFunctionAsync(SqlDataReader dr)
}
dr.Close();

return message;
return message ?? new Message();
}
}
}
4 changes: 2 additions & 2 deletions src/Paramore.Brighter/ExternalBusServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -173,7 +173,7 @@ internal async Task ClearOutboxAsync(IEnumerable<Guid> 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());
Expand Down

0 comments on commit f6dbac5

Please sign in to comment.