[Update by Udi] If you want to set a header on a specific message that you're sending, just call the .SetHeader(key, value);
method on the message object. The static outgoing headers is useful for process-wide data like who the logged-in user is in a desktop application.[End update]
MessageHeaderManager
is a IMutateOutgoingTransportMessages
which means it only is concerned with messages on their way out. There are no incoming message headers on display here.
messageHeaders
is concerned with headers that are set per-message, like time sent, or anything you would set manually from a message handler.
staticOutgoingHeaders
is a place to cache all headers that are the same for every single message out of an endpoint so that their values don't need to be recalculated. This would include things like the source machine name.
If you look into the guts of that MutateOutgoing method, you will see that all of the key/value pairs from both messageHeaders
and staticOutgoingHeaders
are added to the transportMessage.Headers
collection. Additionally, the static ones are added with Headers.Add(key, value)
while the thread-static headers are added via Headers[key] = value
so that an item from the thread-static collection would override a static header of the same name.
Here's a link to the full source for this class on GitHub, linked by the tag for V4.0.3 (current at time of writing) so hopefully that link won't expire.