发布和获取ack / nacks的工作正常。我在这里的担心是,它不会关闭未使用的额外通道。另一方面,将发布者确认设置为false时,未使用的通道将按预期关闭。
ConnectionFactory示例:
cachingConnectionFactory.setCacheMode(CachingConnectionFactory.CacheMode.CHANNEL);
cachingConnectionFactory.setChannelCacheSize(confirmChannelCacheSize);
cachingConnectionFactory.setPublisherConfirms(Boolean.TRUE);
cachingConnectionFactory.setPublisherReturns(Boolean.TRUE);
RabbitTemplate示例:
template.setMandatory(true);
template.setConfirmCallback(deepConfirmCallback);
template.setReturnCallback(returnCallback);
Spring AMQP依赖项:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
转载;正在调查.....