package com.springboot.cloud.gateway.events;

import com.springboot.cloud.gateway.service.RouteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.route.RouteDefinition;
import org.springframework.stereotype.Component;


//TODO 待实现删除，更新操作
@Component
@Slf4j
public class BusReceiver {

    @Autowired
    private RouteService routeService;

    public void handleMessage(RouteDefinition routeDefinition) {
        log.info("Received Message:<{}>", routeDefinition);
        routeService.save(routeDefinition);
    }
}
