package com.usky.fire.service.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Slf4j
@Component
public class RabbitMQListener {

//    @RabbitHandler
//    @RabbitListener(queues = "Patrol_QEvent")  //监听名称为Patrol_QEvent队列消息
//    public void process(Map testMessage){
//        System.out.println("DirectReceiver消费者收到消息： " + testMessage.toString());
//    }
//
//    @RabbitHandler
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(),
//            exchange = @Exchange(value = "Patrol_FEvent",type = ExchangeTypes.FANOUT)
//    ))
//    public void getData(Message message){
//        try {
//            String str = new String(message.getBody(),"utf-8");
//            System.out.println("FanoutReceiver消费者收到消息： " + str);
//        } catch (Exception e){
//            e.printStackTrace();
//        }
//    }
}
