因为rabbitmq 提供了java对象json序列化的支持,然后出现了,
Channel shutdown: channel error; protocol method: #method
(reply-code=406, reply-text=PRECONDITION_FAILED - unknown delivery tag 1, class-id=60, method-id=80)
因为在
-
@Bean
-
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
-
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
-
factory.setConnectionFactory(connectionFactory);
-
factory.setMessageConverter(new Jackson2JsonMessageConverter());
-
-
return factory;
-
}
添加了
factory.setMessageConverter(new Jackson2JsonMessageConverter());
rabbitmq的ack 就被设置为自动提交,即使配置文件
添加了
-
## springboot整合rabbitmq的基本配置
-
spring:
-
rabbitmq:
-
addresses: 192.168.10.123:5672
-
username: xxxx
-
password: xxxx
-
virtual-host: /
-
publisher-confirms: true
-
publisher-returns: true
-
template:
-
mandatory: true
也没有任何作用,只好重新设置
factory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
阅读(41569) | 评论(0) | 转发(1) |