Closed Nemadjo94 closed 2 years ago
I tested this and it works fine (I was able to resolve HttpContextAccessor in my test step) but I'm not sure if this is the right implementation.
Cool! One thing, though: You are injecting IComponentContext
into the ctor of ComponentContextProviderStep
, but since Rebus' pipeline consists of singleton steps, they are built when the bus is started, and so the IComponentContext
is resolved only once.
I don't know much about Autofac, but wouldn't it be better to resolve it in the Process
method of the step?
Apart from that, I think your implementation looks really good, and it would be awesome if you would send a PR if you are interested in having it included in the next version š
Hi! I'm glad you like my implementation, I would gladly send a PR. I just have to take some time first to re-read the old notes since I moved on to other things on the project in the meantime :)
I don't know much about Autofac either but I believe you're right, I'll give it a try and see how it goes.
Hi @Nemadjo94 , did you get any further with this one?
@mookid8000 Sorry, I didn't have the time to work on the PR since I moved to another project where we don't use Rebus :/
Ok, fair enough š feel free to come but if/when you get to use Rebus again š
Hi! I noticed that
ComponentContext
cannot be resolved in steps like inRebus.ServiceProvider
package where theServiceProviderProviderStep
provides theServiceProvider
for the rest of the pipeline. Would it be possible to enable resolvingComponentContext
in steps for the next version?For example in my project we are using rebus middleware to fetch the headers from http context and set them to message context for audit purposes. Something like this:
But in order for our steps to be able to resolve services from
ComponentContext
, I created an extension method which will enable theComponentContextProviderStep
to provide theComponentContext
for the rest of the pipeline. Like this:Also I played around a bit with the
Rebus.Autofac
package and managed to set up theComponentContextProviderStep
. Like this:I tested this and it works fine (I was able to resolve
HttpContextAccessor
in my test step) but I'm not sure if this is the right implementation.