All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.actuate.bootstrap.discovery.routing.AppRoutingEndpoint Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.actuate.bootstrap.discovery.routing;

import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.zodiac.core.bootstrap.breaker.routing.AppRoutingInfo;
import org.zodiac.sdk.toolkit.util.ExceptionUtil;

@RestControllerEndpoint(id = AppRoutingEndpoint.ENDPOINT_NAME)
public class AppRoutingEndpoint {

    public static final String ENDPOINT_NAME = "app-routing";

    private AppRoutingInfo routingInfo;

    public AppRoutingEndpoint(AppRoutingInfo routingInfo) {
        this.routingInfo = routingInfo;
    }

    @GetMapping(value = "/", produces = {MediaType.APPLICATION_JSON_VALUE})
    public AppRoutingResponse routings() {
        try {
            if (routingInfo != null) {
                return AppRoutingResponse.successOfData(routingInfo.getRoutings(), routingInfo.getLastModify());
            }
            return AppRoutingResponse.EMPTY_SUCESS;
        } catch (Throwable t) {
            return AppRoutingResponse.failOfMessage(ExceptionUtil.stackTrace(t), routingInfo.getLastModify());
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy