Setting a custom return address header

115 views Asked by At

I need to set a custom return-address as described here https://github.com/rebus-org/Rebus/wiki/Return-addresses but there's no attachheader option anymore.

How do I achieve this in rebus2?

1

There are 1 answers

4
mookid8000 On BEST ANSWER

All methods on IBus that send messages have an optional parameter that accepts a headers dictionary.

Therefore, you can simply

var headers = new Dictionary<string, string> {
    { Headers.ReturnAddress, "wherever" }
};

await bus.Send(yourMessage, headers);

in order to set a custom return address :)