Created
April 4, 2018 14:40
-
-
Save ramonsmits/970c8a29d825b044b40479aaaf8c52cd to your computer and use it in GitHub Desktop.
NServiceBus - Add a strack trace to every message send
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AddStackTraceMutator : IMutateOutgoingTransportMessages | |
| { | |
| public Task MutateOutgoing(MutateOutgoingTransportMessageContext context) | |
| { | |
| context.OutgoingHeaders["StackTrace"] = System.Environment.StackTrace; | |
| return Task.CompletedTask; | |
| } | |
| } | |
| endpointConfiguration.RegisterMessageMutator(new AddStackTraceMutator ()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Via send options | |
| var sendOptions = new SendOptions(); | |
| sendOptions.SetHeader("StackTrace", System.Environment.StackTrace); | |
| await context.Send(myMessage, sendOptions).ConfigureAwait(false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment