0

I upgraded MassTransit from v7 to v8 and I am getting some new log messages and want to make sure nothing serious is happening. When I start up my console apps (either together or individually) I get the following:

[10:01:54 WRN] Start called, but the host was already started: rabbitmq://localhost/ (Already Started)
[10:01:55 INF] Bus started: rabbitmq://localhost/
[10:01:55 INF] Bus started: rabbitmq://localhost/

I'm not sure if this is an issue. In my Program.cs file, I am only adding that bus once and then I add that to a HostBuilder and run is once. So I can't understand why the bus is attempting to start again.

As far as I can tell, messages are being handled as expected and I don't see any leaks, but I want to make sure that I'm not introducing any memory or message leaks due to this issue. I wasn't getting these messages before upgrading, so I don't know if the upgrade was what caused this issue or not.

1 Answers1

1

You might review the upgrade guide and make sure you don't have any deprecated assemblies or are otherwise starting the bus yourself when the MassTransit hosted service already does it for you.

Chris Patterson
  • 28,659
  • 3
  • 47
  • 59
  • I found the part about how the IHostedService will be added automatically to MassTransit. The problem is that my program uses a custom IHostedService that we add to the service collection. Is there a way to override that behavior, or can I pass in the custom IHostedService to replace what MassTransit auto-adds? – Christopher Fernandez Jun 28 '22 at 18:05
  • There is a `RemoveMassTransitHostedService` extension method in the latest release you can use to remove MT's hosted service. Recognize that its behavior may not be akin to yours, so I'd recommend using MT's over copying its behavior exactly. – Chris Patterson Jun 28 '22 at 18:17
  • Although I say custom, in reality it is just extending the functionality with some extra things we are using. That did work, though. Thanks for your help Chris! – Christopher Fernandez Jun 28 '22 at 18:36