Skip to content

Commit

Permalink
Don't send SpanContext with Message (use header).
Browse files Browse the repository at this point in the history
  • Loading branch information
houseofcat committed Apr 14, 2024
1 parent d0021f8 commit 8dc1655
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/HouseofCat.RabbitMQ/Messages/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public interface IMessage

IBasicProperties BuildProperties(IChannelHost channelHost, bool withOptionalHeaders, string contentType);

[JsonIgnore]
public SpanContext? ParentSpanContext { get; set; }
}

Expand Down Expand Up @@ -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()
Expand Down
12 changes: 8 additions & 4 deletions tests/RabbitMQ.ConsumerDataflows.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down

0 comments on commit 8dc1655

Please sign in to comment.