RabbitMQ异常之inequivalent arg ‘x-message-ttl‘ for queue ‘‘ in vhost ‘/‘

rabbitmq参数异常

如果遇到此错误,有可能是客户端消费的时候未设置”x-message-ttl”参数,或设置的与服务器上的不一至导至的。

解决方法:

在服务器上查询参数值

在这里插入图片描述

配置rabbitmq时加入

  @Bean(QUEUE_INFORM_LAMP)
    public Queue QUEUE_INFORM_EMAIL(){
        Map map=new HashMap();
        map.put("x-message-ttl",300000);
        return new Queue(QUEUE_INFORM_LAMP,true,false,false,map);
    }

或者

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "tiopic.queueq1",arguments = {@Argument(name = "x-message-ttl",value = "30000")}),
            exchange = @Exchange(value = "topic", type = ExchangeTypes.TOPIC),
    ))

本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/7a58a2ffb7.html