Resolving Service Within Consumer Middleware

33 views
Skip to first unread message

Ashley Poole

unread,
Aug 10, 2020, 4:44:57 PM8/10/20
to masstransit-discuss
I'm looking at writing a middleware for Masstransit for when consuming messages, but I'm unsure how to inject a dependency into the middleware from the dependency injection container (scoped). I have the middleware working to read the headers, etc, but i'm just not sure how to inject a dependency. I've read numerous other issues but it's still not clear how to achieve this.  Is there any guidance on this that I could look at or maybe an example?

For reference, this is a .NET 3.1 application using Masstransit v7 with the house of box DI container on top of Azure Service Bus (using MassTransit.AzureServiceBus package.

Would appreciate any guidance!

Ashley Poole

unread,
Aug 10, 2020, 4:50:56 PM8/10/20
to masstransit-discuss
I should also mention this is a filter middleware.

Chris Patterson

unread,
Aug 11, 2020, 8:32:49 AM8/11/20
to masstrans...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/bf81a39b-7f24-4f84-94de-970d7df97840o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages