Skip to content

Instantly share code, notes, and snippets.

@dario-l
Created February 20, 2024 11:01
Show Gist options
  • Save dario-l/a8012dbaf94766cdcf2b44dfcaf5e515 to your computer and use it in GitHub Desktop.
Save dario-l/a8012dbaf94766cdcf2b44dfcaf5e515 to your computer and use it in GitHub Desktop.
Slow MassTransit bus startup
using System.Diagnostics;
using MassTransit;
var busControl = Bus.Factory.CreateUsingRabbitMq(cfg =>
{
cfg.Host(new Uri($"amqps://rabbitmq:rabbitmq@localhost:5671/"));
foreach (int i in Enumerable.Range(0, 50))
{
cfg.ReceiveEndpoint($"mt-test-{i}", e => { });
}
});
var sw = Stopwatch.StartNew();
await busControl.StartAsync();
sw.Stop();
Console.WriteLine($"Elapsed {sw.Elapsed}");
await busControl.StopAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment