From 8dc16552b8e1ccbfe8cf241ef6e9b513e5fd8243 Mon Sep 17 00:00:00 2001 From: "Tristan (HouseCat) Hyams" Date: Sun, 14 Apr 2024 16:57:58 -0500 Subject: [PATCH] Don't send SpanContext with Message (use header). --- src/HouseofCat.RabbitMQ/Messages/Message.cs | 2 ++ tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/HouseofCat.RabbitMQ/Messages/Message.cs b/src/HouseofCat.RabbitMQ/Messages/Message.cs index 2b36a0b..2fa5dc5 100644 --- a/src/HouseofCat.RabbitMQ/Messages/Message.cs +++ b/src/HouseofCat.RabbitMQ/Messages/Message.cs @@ -38,6 +38,7 @@ public interface IMessage IBasicProperties BuildProperties(IChannelHost channelHost, bool withOptionalHeaders, string contentType); + [JsonIgnore] public SpanContext? ParentSpanContext { get; set; } } @@ -70,6 +71,7 @@ public sealed class Message : IMessage [JsonIgnore] public string ContentType { get; set; } = Constants.HeaderValueForContentTypeJson; + [JsonIgnore] public SpanContext? ParentSpanContext { get; set; } public Message() diff --git a/tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs b/tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs index e7b3d3b..12597cb 100644 --- a/tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs +++ b/tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs @@ -34,20 +34,24 @@ }); dataflowService.AddStep( - "create_new_message", - (state) => + "create_new_secret_message", + async (state) => { - state.SendMessage = new Message + var message = new Message { Exchange = "", RoutingKey = "TestTargetQueue", - Body = Encoding.UTF8.GetBytes("Test New Message"), + Body = Encoding.UTF8.GetBytes("Secret Message"), Metadata = new Metadata { PayloadId = Guid.NewGuid().ToString(), }, ParentSpanContext = state.WorkflowSpan?.Context, }; + + await rabbitService.ComcryptAsync(message); + + state.SendMessage = message; return state; });