package com.muyu.carData.consumer;

import com.muyu.carData.util.CacheUtil;
import com.muyu.enterprise.cache.faultCode.VehicleCacheFaultCodeAddService;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**车辆上线消费者
 * @Author：张腾
 * @Package：com.muyu.carData.consumer
 * @Project：cloud-server-8
 * @name：CarOnlineConsumer
 * @Date：2024/10/4 14:27
 */
@Log4j2
@Component
public class CarOnlineConsumer {

    @Autowired
    private CacheUtil cacheUtil;

    @Autowired
    private VehicleCacheFaultCodeAddService vehicleCacheCarInformationAddService;


    @RabbitListener(queues = "myQueue",containerFactory = "rabbitListenerContainerFactory")
    public void consumeMessage(String message) {
        // 处理接收到的消息
        log.info("接收到消息======>>" + message);
    }

/*
    @Bean
    public DirectExchange initVehicleGatewayExchange(){
        return new DirectExchange(VehicleGatewayConstants.VEHICLE_GETAWAY_EXCHANGE);
    }*/



  /*@Bean
    @Primary
    public Queue initQueue(){
        return new Queue("gateway", true);
    }

    @Bean
    public Binding binding1a(DirectExchange initVehicleGatewayExchange,
                             Queue initQueue) {
        return BindingBuilder.bind(initQueue)
                .to(initVehicleGatewayExchange)
                .with(VehicleGatewayConstants.VEHICLE_GETAWAY_ROUTING_KEY);
    }

    @RabbitListener(queues = "gateway")
    public void msg(@RequestBody WebHookConnection webHookConnection){
        log.info("消费者接收到车辆上线信息:{}",webHookConnection);
    }*/
}
