Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8967385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:13:54+00:00 2026-06-15T17:13:54+00:00

For some reason I can not post to the masstransit google group , even

  • 0

For some reason I can not post to the masstransit google group, even though I joined, I am told that I do not have permission to post to this group. So I am going to post here…

Now for my problem:

I am using MassTransit v2.7.2, with AutoFac v2.6.3. I am trying to configure Autofac to scan an assembly and register my consumers; all types that implement the IConsumer interface. This seems to work.

I am using the MassTransit.AutofacIntegration assembly and the LoadFrom(...) extension method to register the consumers from the container with MassTransit when I configure the bus. Here is the code:

var builder = new ContainerBuilder();
builder
      .RegisterAssemblyTypes(typeof (CreateElectionCommandHandler).Assembly)
      .Where(type => type.Implements<IConsumer>())
      .AsSelf();
var container = builder.Build();

var localBus = ServiceBusFactory.New(configurator =>
                                         {
                                             //configurator.ReceiveFrom("loopback://localhost/testqueue");
                                             configurator.ReceiveFrom("rabbitmq://localhost/commandqueue");
                                             configurator.UseRabbitMq();
                                             configurator.Subscribe(sbc => sbc.LoadFrom(container));
                                         });

Assert.IsTrue(container.IsRegistered<CreateElectionCommandHandler>());
Assert.IsTrue(container.IsRegistered<TerminateElectionCommandHandler>());
Assert.AreEqual(1, localBus.HasSubscription<CreateElection>().Count());
Assert.AreEqual(1, localBus.HasSubscription<TerminateElection>().Count());

If I run the above code using the loopback

configurator.ReceiveFrom("loopback://localhost/testqueue");

configuration (comment out the rabbitmq conifig), the test will pass.

If I comment out the “loopback” config and comment in the

 configurator.ReceiveFrom("rabbitmq://localhost/commandqueue");
 configurator.UseRabbitMq();

config, the test will fail. (Note: The rabbitmq queue is already up and running – I have been using it as part of my POC). Specifically, it will fail on the assertion:

Assert.AreEqual(1, localBus.HasSubscription<CreateElection>().Count());
Assert.AreEqual(1, localBus.HasSubscription<TerminateElection>().Count());

Can anybody help me understand what is going on here? I am new to MT so fully anticipating that I am missing something, or not configuring something correctly.

Am I correct to assume that if there are no message subscriptions registered, then the bus will not be able to deliver to any of my consumers (even though the consumers are registered)?

Any help much appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:13:55+00:00Added an answer on June 15, 2026 at 5:13 pm

    With RabbitMQ, subscriptions are not added to the outbound bus until a message is published. This is due to how the classes are inspected and outbound endpoints to the appropriate exchanges are created and added to the pipeline.

    So yes, this test will fail with RabbitMQ, but it will in fact work properly when the message is published.

    The HasSubscription() calls are really meant for verifying that consumers and such are properly configured using the loopback transport, and really just for vetting out things that are not really integration issues but just making sure the internal MassTransit code is working.

    So, if you were to add a Publish() call of one of those types, and then call the HasSubscription() extension method, it would pass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, I can not seem to change the default position of an
For some reason I can't figure out why the nested elements are not appearing
I have this code, and for some reason my $.post function fires twice in
For some reason I can no longer post a comment as an Anonymous user
I have done this several times before but for some reason I can't get
for some reason i can not understand im having troubles with mysql_num_rows. Heres the
For some reason this SQL statement is not working. Can anyone tell me why?
I'm dealing with a scrupt that for some reason can't read normal $_GET and
For some reason, the options are not showing up in my email. I can
I have a search setup inside a div but for some reason cannot get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.