rebus-org / Rebus

:bus: Simple and lean service bus implementation for .NET
https://mookid.dk/category/rebus
Other
2.26k stars 353 forks source link

Question about getting a message header #1131

Closed dazinator closed 5 months ago

dazinator commented 5 months ago

I am in a saga, processing an incoming message.

  public async Task Handle(ExecuteWorkflowCommandMessage message)
    {

I'd like to grab the sender's address so I can reply later on in the saga back to this sender. So I think I just need to grab the senders address at this point from the incoming message and set it in saga state. Then later I can use it at the end of the saga with the ReplyTo capability.

My question is, how do I access this incoming messages header for the senders address?

hjalle commented 5 months ago

Inject "IMessageContext" and get the sender from the headers perhaps? _messageContext.Headers.TryGetValue(Headers.SenderAddress, out var sender)

dazinator commented 5 months ago

Thank you.