@RabbitListener(bindings = @QueueBinding(value = @Queue(value = RabbitMQConfig.DIRECT_QUEUE, durable = "true"), exchange = @Exchange(value = RabbitMQConfig.DIRECT_EXCHANGE, durable = "true", type = ExchangeTypes.DIRECT), key = RabbitMQConfig.DIRECT_ROUTINGKEY))
@RabbitHandler
@Override
public void receiveOrderTopicMessage(@Payload Order order, Channel channel, @Headers Map<String, Object> headers) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("消费端Payload:" + order);
}
Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
//手工ack
channel.basicAck(deliveryTag, false);
}
}
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx