-
-
Save ramonsmits/b274545e3f6891ebd8a5a5c8a936cf02 to your computer and use it in GitHub Desktop.
NServiceBus add StackTrace information to outgoing message
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); | |
| // Via outgoing message mutator, requires registering the mutator via the endpoint configuration. | |
| class AddStackTraceMutator : IMutateOutgoingTransportMessages | |
| { | |
| public Task MutateOutgoing(MutateOutgoingTransportMessageContext context) | |
| { | |
| context.OutgoingHeaders["StackTrace"] = System.Environment.StackTrace; | |
| return Task.CompletedTask; | |
| } | |
| } | |
| endpointConfiguration.RegisterMessageMutator(new AddStackTraceMutator ()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment