首页>代码>springboot-rabbitmq整合(rabbitmq的四种交换器演示、延时队列演示)>/springboot-rabbitmq-master/src/main/java/com/ajwensome/mq/delayqueue/DelayReceiver.java
package com.ajwensome.mq.delayqueue;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author created by qwb on 2018/12/22 14:55
 */
@Component
@Slf4j
public class DelayReceiver {
    @RabbitListener(queues = {DelayRabbitConfig.ORDER_QUEUE_NAME})
    public void orderDelayQueue(Order order, Message message, Channel channel){
        log.info("###############################");
        log.info("【orderDelayQueue 监听的消息】 - 【消费时间】 - [{}]- 【订单内容】 - [{}]",  new Date(), order.toString());
        if(order.getOrderStatus() == 0) {
            order.setOrderStatus(2);
            log.info("【该订单未支付,取消订单】" + order.toString());
        } else if(order.getOrderStatus() == 1) {
            log.info("【该订单已完成支付】");
        } else if(order.getOrderStatus() == 2) {
            log.info("【该订单已取消】");
        }
        log.info("###########################################");
    }
}
最近下载更多
安东尼online  LV11 2023年12月20日
gaoxin222  LV14 2023年6月16日
wxm4252  LV12 2023年5月30日
newhaijun  LV16 2023年3月21日
wangdengzhe  LV7 2022年12月28日
ewan007  LV30 2022年7月6日
axel990  LV6 2022年5月16日
chokkint  LV12 2022年4月14日
tianli3000  LV8 2021年8月10日
gao123qq  LV21 2021年7月8日
最近浏览更多
yhwyhw1  LV2 2023年12月21日
安东尼online  LV11 2023年12月20日
gaoxin222  LV14 2023年6月16日
wxm4252  LV12 2023年5月29日
crosa_Don  LV18 2023年5月19日
杨豫川  LV12 2023年4月27日
newhaijun  LV16 2023年3月21日
guviva  LV6 2023年3月15日
ROCK森  LV12 2022年11月7日
80730176  LV7 2022年10月8日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友