|
@@ -1,49 +0,0 @@
|
|
|
-package com.fdkankan.ucenter.mq.consumer;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
-import com.fdkankan.ucenter.httpClient.vo.PayOrderVo;
|
|
|
-import com.rabbitmq.client.Channel;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang.StringEscapeUtils;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.amqp.core.ExchangeTypes;
|
|
|
-import org.springframework.amqp.core.Message;
|
|
|
-import org.springframework.amqp.rabbit.annotation.Exchange;
|
|
|
-import org.springframework.amqp.rabbit.annotation.Queue;
|
|
|
-import org.springframework.amqp.rabbit.annotation.QueueBinding;
|
|
|
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import sun.rmi.runtime.Log;
|
|
|
-
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
-
|
|
|
-@Slf4j
|
|
|
-@Component
|
|
|
-public class OrderDownConsumer {
|
|
|
-
|
|
|
- @Value("${queue.orderPay.order-down:order-down}")
|
|
|
- private String orderDownQueue;
|
|
|
- @Value("${queue.orderPay.down-payResult:down-payResult}")
|
|
|
- private String orderPayResultQueue;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- RabbitMqProducer rabbitMqProducer;
|
|
|
-
|
|
|
-
|
|
|
- @RabbitListener(
|
|
|
- queuesToDeclare = @Queue("${queue.orderPay.down-payResult:down-payResult}")
|
|
|
- )
|
|
|
- public void consumerQueue(Channel channel, Message message) throws Exception {
|
|
|
- String messageId = message.getMessageProperties().getMessageId();
|
|
|
- String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
- log.info("接受下单结果mq消息:messageId:{},msg:{}",messageId,msg);
|
|
|
- channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
|
|
-
|
|
|
- msg = StringEscapeUtils.unescapeJava(msg);
|
|
|
- PayOrderVo order = JSONObject.parseObject(msg, PayOrderVo.class);
|
|
|
-
|
|
|
- }
|
|
|
-}
|