Autofac : Multiple Consumers different queues

233 views
Skip to first unread message

Kiran

unread,
May 11, 2016, 3:44:38 PM5/11/16
to masstransit-discuss
Currently we are using the Auofac to load multiple consumers. But all the consumers are hosted on the same queue. Is there a way (using autofac) to host consumers on different queues 

Current implementation similar to 

builder.Register(context =>
            {
                var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
                {
                    var host = cfg.Host(new Uri("rabbitmq://localhost/"), h =>
                    {
                        h.Username("guest");
                        h.Password("guest");
                    });

                    cfg.ReceiveEndpoint("customer_update_queue", ec =>
                    {
                        ec.LoadFrom(context);
                    });
                });

                return busControl;
            })
Thanks

Chris Patterson

unread,
May 12, 2016, 9:04:29 AM5/12/16
to masstrans...@googlegroups.com
We usually create child lifetime scopes and register the consumers in those separate lifetime scopes, and then register those receive endpoints with the nested lifetime scopes. That's how the MassTransit.Host works, each endpoint configurator is a child lifetime scope in Autofac.

You might look at the code for the Host for some ideas on how to do it -- or you could just use the host. :)


--
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 post to this group, send email to masstrans...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/f48bd0ac-f2fd-4b00-8098-3e811917f96d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kiran

unread,
May 16, 2016, 3:31:46 PM5/16/16
to masstransit-discuss
MassTransit.Host looks promising but don't see any sample on how to use it. Looking at the code looks like it scans for all dlls and looks for IEndpointSpecification, IServiceSpecification, and IHostBusFactory. not sure how to implement these. Can you provide some direction.

Thanks

Chris Patterson

unread,
May 16, 2016, 3:58:22 PM5/16/16
to masstrans...@googlegroups.com
There is a sample in the project you can review, documentation is still pending...



On Mon, May 16, 2016 at 12:31 PM, Kiran <kiran....@gmail.com> wrote:
MassTransit.Host looks promising but don't see any sample on how to use it. Looking at the code looks like it scans for all dlls and looks for IEndpointSpecification, IServiceSpecification, and IHostBusFactory. not sure how to implement these. Can you provide some direction.

Thanks

--
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 post to this group, send email to masstrans...@googlegroups.com.

Kiran

unread,
May 16, 2016, 4:04:44 PM5/16/16
to masstransit-discuss
Aweeeesomeee thanks much.

Kiran

unread,
May 16, 2016, 4:28:16 PM5/16/16
to masstransit-discuss
How do i configure rabbitMQ?

Chris Patterson

unread,
May 16, 2016, 4:32:17 PM5/16/16
to masstrans...@googlegroups.com
Via the app config, for the host: 


You also have to add a reference to your project to RabbitMQ, so the transport is in the folder and found by the host startup logic.


On Mon, May 16, 2016 at 1:28 PM, Kiran <kiran....@gmail.com> wrote:
How do i configure rabbitMQ?

--
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 post to this group, send email to masstrans...@googlegroups.com.

Kiran

unread,
May 17, 2016, 1:09:57 PM5/17/16
to masstransit-discuss
Worked like a charm. Thanks so much.
Reply all
Reply to author
Forward
0 new messages