mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
rabbitMQ
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.jsowell.mq;
|
||||
|
||||
import com.jsowell.pile.dto.AfterSettleOrderDTO;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class OrderRabbitListener {
|
||||
|
||||
/**
|
||||
* 多线程消费请求消息
|
||||
* @param message
|
||||
*/
|
||||
// @RabbitListener(queues = RabbitConstants.QUEUE_CHARGE_ORDER_DATA)
|
||||
public void receiveChargeOrderData(AfterSettleOrderDTO afterSettleOrderDTO, Channel channel, Message message) throws IOException {
|
||||
log.info("接收到订单结算数据:{}", afterSettleOrderDTO);
|
||||
//由于配置设置了手动应答,所以这里要进行一个手动应答。注意:如果设置了自动应答,这里又进行手动应答,会出现double ack,那么程序会报错。
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user