Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subscribe mt queue to autofac module

I'm trying to setup a single service that is broken into several logical services. Because they are logical services, they each get there own queue. Each logical service is a module in autofac.

The setup looks vaguely like:

sbc.ReceiveEndpoint(host, "service1", ep => {
  ep.LoadFrom(c.Resolve<ILifetimeScope>())
});
sbc.ReceiveEndpoint(host, "service2", ep => {
  ep.LoadFrom(c.Resolve<ILifetimeScope>())
});

But I think this would cause every consumer to be subscribed on every queue.

Is there a built in way I can get autofac to only register consumers from a specific module or would I have to write my own adapter?

like image 476
flukus Avatar asked Sep 10 '26 14:09

flukus


1 Answers

You would need to write your own adapter. It's not a lot of work. Make sure you resolve the consumers from the container as the concrete class, and not as implementation of Consumes.

like image 87
Travis Avatar answered Sep 15 '26 08:09

Travis