package com.bawei.mall.search.rabbit;

import com.alibaba.fastjson2.JSONObject;
import com.bawei.common.rabbit.constant.QueueConstant;
import com.bawei.common.rabbit.domain.Message;
import com.bawei.mall.product.domain.reponse.ProductInfoResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Configuration;

/**
 * @author DongZl
 * @description: rabbit测试
 * @Date 2022-10-21 下午 01:56
 */
@Configuration
public class RabbitTest {

    /**
     * 日志
     */
    private static final Logger log = LoggerFactory.getLogger(RabbitTest.class);

    /**
     * 接受测试消息
     * @param msg
     */
    @RabbitListener(queues = QueueConstant.TEST_NAME)
    public void listen(Message<ProductInfoResponse> msg) {
        log.info(JSONObject.toJSONString(msg));
    }
}
