Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NServiceBus - How to pass custom headers in the Message envelop?

I want to be able to attach the windows authentication token without having to include that piece of data on the messages themselves.

I've noticed that TransportMessage has Headers, but how do I get access to that before Send message to server?

like image 879
John Simons Avatar asked Feb 28 '23 00:02

John Simons


1 Answers

See the Header Manipulation Sample there you'll see how to use headers.

To set a constant outgoing header for a client (suitable for the auth token you want), see Writing outgoing headers for all outgoing-messages

On the server, you can then Read the header.

like image 99
Udi Dahan Avatar answered Mar 06 '23 17:03

Udi Dahan