Open Closed

RabbitMQ not getting triggered it just throws exception when publishing event to Identity Microservice #2423


User avatar
0
amansharma created

Hi we have Microservice application deployed on AWS.

We are getting following exception when we are publishing an event to Identity Microservice this happens only on deployed website

Please provide us solution as what we should do. as this is urgent

  • ABP Framework version: 5.0.0
  • UI type: Angular
  • DB provider: EF Core
  • Exception message and stack trace:

RabbitMQ POD logs

` [erro] <0.32031.0> operation queue.declare caused a channel exception precondition_failed: inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'`

Identity Service POD logs

 `[15:56:16 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:16 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:21 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:21 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:26 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:26 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:31 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()
[15:56:31 WRN] The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=406, text='PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'Portal_IdentityService' in vhost '/': received none but current is the value 'Portal_dead_letter' of type 'longstr'', classId=50, methodId=10
   at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
   at RabbitMQ.Client.Impl.ModelBase.QueueDeclare(String queue, Boolean passive, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at RabbitMQ.Client.Impl.AutorecoveringModel.QueueDeclare(String queue, Boolean durable, Boolean exclusive, Boolean autoDelete, IDictionary`2 arguments)
   at Volo.Abp.RabbitMQ.RabbitMqMessageConsumer.TryCreateChannelAsync()


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    In 4.4 we use dead letter queues for RabbitMQ, But in 5.0 we introduced the inbox outbox pattern, so we no longer use the dead letter queue.

    Sorry RabbitMQ does not support update queues, you may need to delete existing queues.

    See https://dev.to/ottonova/how-and-why-we-updated-rabbitmq-queues-on-production-2h76

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    If you don't want to delete the queue.

    You can try:

    [Dependency(ReplaceServices = true)]
    public class MyRabbitMqMessageConsumer : RabbitMqMessageConsumer
    {
        public MyRabbitMqMessageConsumer(IConnectionPool connectionPool, AbpAsyncTimer timer, IExceptionNotifier exceptionNotifier) : base(connectionPool, timer, exceptionNotifier)
        {
        }
    
        protected override Task TryCreateChannelAsync()
        {
            Queue.Arguments["x-dead-letter-exchange"] = Exchange.ExchangeName+"_dead_letter";;
            Queue.Arguments["x-dead-letter-routing-key"] = Queue.QueueName+"_dead_letter";
            return base.TryCreateChannelAsync();
        }
    }
    
    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IRabbitMqMessageConsumerFactory))]
    public class MyRabbitMqMessageConsumerFactory : IRabbitMqMessageConsumerFactory, ISingletonDependency, IDisposable
    {
        protected IServiceScope ServiceScope { get; }
    
        public MyRabbitMqMessageConsumerFactory(IServiceScopeFactory serviceScopeFactory)
        {
            ServiceScope = serviceScopeFactory.CreateScope();
        }
    
        public IRabbitMqMessageConsumer Create(
            ExchangeDeclareConfiguration exchange,
            QueueDeclareConfiguration queue,
            string connectionName = null)
        {
            var consumer = ServiceScope.ServiceProvider.GetRequiredService<MyRabbitMqMessageConsumer>();
            consumer.Initialize(exchange, queue, connectionName);
            return consumer;
        }
    
        public void Dispose()
        {
            ServiceScope?.Dispose();
        }
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09