I’m trying to forward Correlation Id from incoming to outgoing messages.
It wasn’t too hard i just added outgoing step that loads both current message and incoming message being handled and read/add the correlation Id to header.
Problem is in some cases we are using RebusTransactionScopeSuppressor when sending a message because we want to send it immediately in which case same outgoing step doesn’t work because it cannot load message that is being handled.
My idea was to add some scoped service that would write correlationId and read it per request. I cannot seems to get service into step contexts.
I tried loading IServiceScope
and then using it for resolving my scoped service like this below
var scope = context.Load<IServiceScope>() ?? context.Load<AsyncServiceScope?>();
Where I’m, struggling is outgoing process. I manage to make it work for incoming messages but i cannot seem to find IServiceScope
in Outgoing context
Nikola Vacic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.