org.zodiac.actuate.bootstrap.discovery.routing.AppRoutingEndpoint Maven / Gradle / Ivy
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