Merge pull request #180 from xiaolongzuo/master

Update SchedulerX endpoint.
pull/185/head
Xiaolong Zuo 6 years ago committed by GitHub
commit 78d10a866c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,6 +20,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.cloud.alicloud.context.edas.EdasProperties;
import org.springframework.cloud.alicloud.context.scx.ScxProperties; import org.springframework.cloud.alicloud.context.scx.ScxProperties;
import java.util.HashMap; import java.util.HashMap;
@ -35,7 +36,10 @@ public class ScxEndpoint {
private ScxProperties scxProperties; private ScxProperties scxProperties;
public ScxEndpoint(ScxProperties scxProperties) { private EdasProperties edasProperties;
public ScxEndpoint(EdasProperties edasProperties, ScxProperties scxProperties) {
this.edasProperties = edasProperties;
this.scxProperties = scxProperties; this.scxProperties = scxProperties;
} }
@ -46,6 +50,7 @@ public class ScxEndpoint {
public Map<String, Object> invoke() { public Map<String, Object> invoke() {
Map<String, Object> scxEndpoint = new HashMap<>(); Map<String, Object> scxEndpoint = new HashMap<>();
LOGGER.info("SCX endpoint invoke, scxProperties is {}", scxProperties); LOGGER.info("SCX endpoint invoke, scxProperties is {}", scxProperties);
scxEndpoint.put("namespace", edasProperties == null ? "" : edasProperties.getNamespace());
scxEndpoint.put("scxProperties", scxProperties); scxEndpoint.put("scxProperties", scxProperties);
return scxEndpoint; return scxEndpoint;
} }

@ -19,6 +19,7 @@ package org.springframework.cloud.alicloud.scx.endpoint;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.cloud.alicloud.context.edas.EdasProperties;
import org.springframework.cloud.alicloud.context.scx.ScxProperties; import org.springframework.cloud.alicloud.context.scx.ScxProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -30,7 +31,7 @@ import org.springframework.context.annotation.Bean;
public class ScxEndpointAutoConfiguration { public class ScxEndpointAutoConfiguration {
@Bean @Bean
public ScxEndpoint scxEndpoint(ScxProperties scxProperties) { public ScxEndpoint scxEndpoint(EdasProperties edasProperties, ScxProperties scxProperties) {
return new ScxEndpoint(scxProperties); return new ScxEndpoint(edasProperties, scxProperties);
} }
} }

Loading…
Cancel
Save