ReceiveTransport Faulted, Restarting

327 views
Skip to first unread message

Maycon Beserra

unread,
Jan 26, 2020, 3:08:54 PM1/26/20
to masstransit-discuss
Hi there,

I use MassTransit 5.5.1 with .NET Core 2.1 and unfortunately, from time to time we get the error:

RabbitMQ Connect Failed: Operation interrupted
RabbitMQ Connect Failed: ReceiveTransport Faulted, Restarting

As we run RMQ in cluster mode, I think it should not happen the issue above.

How can I troubleshoot the issue? Is the issue due one of the nodes are down?

ConfigureBus used by me is below.

        public static IBusControl ConfigureBus(
           IServiceProvider serviceProvider,
           RabbitMQSettings configuration,
           List<ConsumerConfig> consumers = null,
           Action<IRabbitMqBusFactoryConfigurator> customConfiguration = null)
       {
           var defaultServer = configuration.Servers.First();

            return Bus.Factory.CreateUsingRabbitMq(cfg =>
           {
               cfg.UseSerilogEnricher();

                var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
               cfg.UseExtensionsLogging(loggerFactory);

                var host = cfg.Host(new Uri($"rabbitmq://{defaultServer}:/"), h =>
               {
                   h.Username(configuration.Username);
                   h.Password(configuration.Password);
                   h.PublisherConfirmation = false;
                   h.UseCluster(c => c.ClusterMembers = configuration.Servers);
               });

                if (!string.IsNullOrWhiteSpace(configuration.ServiceName) && consumers?.Any() == true && !configuration.DisableConsuming)
               {
                   foreach (var consumer in consumers)
                   {

                        var queueName = new QueueNameBuilder().GetQueueName(configuration.ServiceName, consumer.ConsumerType);

                        cfg.ReceiveEndpoint(host, queueName, e => {
                           e.UseMessageRetry(r => r.Interval(configuration.RetryCount, TimeSpan.FromSeconds(configuration.RetryIntervalSec)));
                           // find and call e.Consumer<Consumer>();
                           e.Consumer(new ConsumerBuilder().BuildType(consumer.ConsumerType), t => serviceProvider.CreateScope().ServiceProvider.GetService(t));
                       });
                   }
               }

                customConfiguration?.Invoke(cfg);
           });
       }

I'm not sure if it's an issue with the library which doesn't work well with a cluster.

Best Regards
Reply all
Reply to author
Forward
0 new messages