Skip to content

RabbitMq - Balanced durability mode causes exception. #746

Description

@kurtdwarwick

Describe the bug
If I have Wolverine set up to use RabbitMq with conventional routing, with or without durable in and out boxes, and the durability mode set to Balanced then:

  1. This exception is thrown for each listener when starting the application:
fail: Wolverine.RabbitMQ.Internal.RabbitMqListener[0]
      Callback error in Rabbit Mq agent Wolverine.RabbitMQ.Internal.RabbitMqListener
      System.InvalidOperationException: Should never be called.
         at RabbitMQ.Client.AsyncDefaultBasicConsumer.RabbitMQ.Client.IBasicConsumer.HandleBasicConsumeOk(String consumerTag)
  1. This exception is thrown when messages are published to one of the queues:
fail: Wolverine.RabbitMQ.Internal.RabbitMqListener[0]
      Callback error in Rabbit Mq agent Wolverine.RabbitMQ.Internal.RabbitMqListener
      System.InvalidOperationException: Should never be called.
         at RabbitMQ.Client.AsyncDefaultBasicConsumer.RabbitMQ.Client.IBasicConsumer.HandleBasicDeliver(String consumerTag, UInt64 deliveryTag, Boolean redelivered, String exchange, String routingKey, IBasicProperties properties, ReadOnlyMemory`1 body)
         at RabbitMQ.Client.Impl.ConcurrentConsumerDispatcher.<>c__DisplayClass10_0.<HandleBasicDeliver>b__0()

To Reproduce

  1. I am using WolverineFx and WolverineFx.RabbitMQ version 1.18.1 and RabbitMQ.Client version 6.8.1
  2. I am using the latest docker image for rabbitmq:management
  3. This is a snippet of code I have used to configure Wolverine with RabbitMq, leaving Wolverine on the default durability mode (Balanced):
var configuration = options
  .UseRabbitMq(settings =>
  {
    settings.UserName = "user";
    settings.Password = "password";
    settings.VirtualHost = "virtual_host";
  })
  .UseConventionalRouting(configuration => configuration
    .QueueNameForListener(type => type.FullName.Replace('.', '-').ToLower())
    .ExchangeNameForSending(type => type.FullName.Replace('.', '-').ToLower())
    .ConfigureListeners((listener, context) => listener.UseDurableInbox())
    .ConfigureSending((sender, context) => sender.UseDurableOutbox()))
  .EnableWolverineControlQueues()
  .AutoProvision();
  1. This is the only configuration I am using for Wolverine:
options.AutoBuildMessageStorageOnStartup = true;
options.Policies.AutoApplyTransactions();

options.UseNewtonsoftForSerialization(config =>
{
  config.NullValueHandling = NullValueHandling.Ignore;
  config.TypeNameHandling = TypeNameHandling.None;
  config.Converters.Add(new StringEnumConverter());
  config.ContractResolver = new DefaultContractResolver
  {
    NamingStrategy = new CamelCaseNamingStrategy()
  };
});

Screenshots

Startup exceptions:

image

Exceptions when messages are published:

image

Additional context
Using the Solo durability mode mitigates these issues, and everything runs as expected.

Thanks

Kurt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions