package com.pannk.listener;

import com.pannk.cons.Constant;
import com.pannk.entity.MessageEntity;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 主题消费
 *
 * @author wolf
 * @date 20-11-17
 */
//@Component
public class TopicReceiveListener {

    /**
     * 处理订单
     *
     * @param messageEntity
     */
    @RabbitListener(queues = {Constant.TOPIC_ORDER})
    @RabbitHandler
    public void handleOrder(MessageEntity messageEntity) {
        System.out.println("Receive order msg id " + messageEntity.getId() + ", code " + messageEntity.getCode() + ", content " + messageEntity.getContent());
    }


    /**
     * 处理咨询
     *
     * @param messageEntity
     */
    @RabbitListener(queues = {Constant.TOPIC_CONSULT})
    @RabbitHandler
    public void handleConsult(MessageEntity messageEntity) {
        System.out.println("Receive consult msg id " + messageEntity.getId() + ", code " + messageEntity.getCode() + ", content " + messageEntity.getContent());
    }
}
