Repository: camel Updated Branches: refs/heads/master 9675bed97 -> 00d1d70ba
http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/examples/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties b/examples/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties new file mode 100644 index 0000000..c98dcbf --- /dev/null +++ b/examples/camel-example-spring-boot-health-checks/service/src/main/resources/application.properties @@ -0,0 +1,25 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +debug = false + +logging.level.org.springframework = INFO + +server.port = 8081 + +endpoints.enabled = false +endpoints.health.enabled = true \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/examples/pom.xml ---------------------------------------------------------------------- diff --git a/examples/pom.xml b/examples/pom.xml index 88e11b7..6a37e78 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -100,6 +100,7 @@ <module>camel-example-spring-boot-clustered-route-controller</module> <module>camel-example-spring-boot-geocoder</module> <module>camel-example-spring-boot-grpc</module> + <module>camel-example-spring-boot-health-checks</module> <module>camel-example-spring-boot-infinispan</module> <module>camel-example-spring-boot-live-reload</module> <module>camel-example-spring-boot-metrics</module> http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java index 292d79a..6e49b2e 100644 --- a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/ConsulComponentConfiguration.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Set; import javax.annotation.Generated; import com.orbitz.consul.option.ConsistencyMode; -import org.apache.camel.CamelContext; import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.apache.camel.util.jsse.SSLContextParameters; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -158,7 +157,19 @@ public class ConsulComponentConfiguration public static class ConsulConfigurationNestedConfiguration { public static final Class CAMEL_NESTED_CLASS = org.apache.camel.component.consul.ConsulConfiguration.class; - private CamelContext camelContext; + /** + * The default action. Can be overridden by CamelConsulAction + */ + private String action; + /** + * Default to transform values retrieved from Consul i.e. on KV endpoint + * to string. + */ + private Boolean valueAsString; + /** + * The default key. Can be overridden by CamelConsulKey + */ + private String key; /** * The Consul agent URL */ @@ -201,10 +212,6 @@ public class ConsulComponentConfiguration */ private String aclToken; /** - * The default action. Can be overridden by CamelConsulAction - */ - private String action; - /** * Sets the username to be used for basic authentication */ private String userName; @@ -230,15 +237,6 @@ public class ConsulComponentConfiguration */ private Boolean pingInstance; /** - * Default to transform values retrieved from Consul i.e. on KV endpoint - * to string. - */ - private Boolean valueAsString; - /** - * The default key. Can be overridden by CamelConsulKey - */ - private String key; - /** * The second to wait for a watch event, default 10 seconds */ private Integer blockSeconds; @@ -251,12 +249,28 @@ public class ConsulComponentConfiguration */ private Boolean recursive; - public CamelContext getCamelContext() { - return camelContext; + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public Boolean getValueAsString() { + return valueAsString; + } + + public void setValueAsString(Boolean valueAsString) { + this.valueAsString = valueAsString; + } + + public String getKey() { + return key; } - public void setCamelContext(CamelContext camelContext) { - this.camelContext = camelContext; + public void setKey(String key) { + this.key = key; } public String getUrl() { @@ -335,14 +349,6 @@ public class ConsulComponentConfiguration this.aclToken = aclToken; } - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = action; - } - public String getUserName() { return userName; } @@ -391,22 +397,6 @@ public class ConsulComponentConfiguration this.pingInstance = pingInstance; } - public Boolean getValueAsString() { - return valueAsString; - } - - public void setValueAsString(Boolean valueAsString) { - this.valueAsString = valueAsString; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - public Integer getBlockSeconds() { return blockSeconds; } http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryAutoConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryAutoConfiguration.java b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryAutoConfiguration.java new file mode 100644 index 0000000..425e84c --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryAutoConfiguration.java @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.consul.springboot.health; + +import java.util.Collections; +import java.util.Map; +import java.util.stream.Collectors; + +import org.apache.camel.component.consul.health.ConsulHealthCheckRepository; +import org.apache.camel.health.HealthCheckRepository; +import org.apache.camel.spring.boot.CamelAutoConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.boot.autoconfigure.AutoConfigureBefore; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.context.annotation.Scope; + +@Configuration +@AutoConfigureBefore(CamelAutoConfiguration.class) +@ConditionalOnProperty(prefix = "camel.component.consul.health.check.repository", value = "enabled") +@EnableConfigurationProperties(HealthCheckRepositoryConfiguration.class) +public class HealthCheckRepositoryAutoConfiguration { + @Autowired + private HealthCheckRepositoryConfiguration configuration; + + @Lazy + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) + @ConditionalOnMissingBean(ConsulHealthCheckRepository.class) + public HealthCheckRepository consulRepository() throws Exception { + return new ConsulHealthCheckRepository.Builder() + .configuration(configuration.asHealthCheckConfiguration()) + .checks(configuration.getChecks()) + .configurations( + configuration.getConfigurations() != null + ? configuration.getConfigurations().entrySet() + .stream() + .collect( + Collectors.toMap(Map.Entry::getKey, e -> e.getValue().asHealthCheckConfiguration()) + ) + : Collections.emptyMap()) + .build(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryConfiguration.java b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryConfiguration.java new file mode 100644 index 0000000..62a213a --- /dev/null +++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/java/org/apache/camel/component/consul/springboot/health/HealthCheckRepositoryConfiguration.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.consul.springboot.health; + +import java.util.List; +import java.util.Map; + +import org.apache.camel.spring.boot.health.AbstractHealthCheckConfiguration; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties("camel.component.consul.health.check.repository") +public class HealthCheckRepositoryConfiguration extends AbstractHealthCheckConfiguration { + /** + * Define the checks to include. + */ + private List<String> checks; + + /** + * Health check configurations. + */ + private Map<String, AbstractHealthCheckConfiguration> configurations; + + // ****************************** + // Properties + // ****************************** + + public List<String> getChecks() { + return checks; + } + + public void setChecks(List<String> checks) { + this.checks = checks; + } + + public Map<String, AbstractHealthCheckConfiguration> getConfigurations() { + return configurations; + } + + public void setConfigurations(Map<String, AbstractHealthCheckConfiguration> configurations) { + this.configurations = configurations; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/resources/META-INF/spring.factories index 8a60338..46411e2 100644 --- a/platforms/spring-boot/components-starter/camel-consul-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/main/resources/META-INF/spring.factories @@ -16,4 +16,5 @@ ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.apache.camel.component.consul.springboot.ConsulComponentAutoConfiguration,\ -org.apache.camel.component.consul.springboot.cloud.ConsulServiceDiscoveryAutoConfiguration +org.apache.camel.component.consul.springboot.cloud.ConsulServiceDiscoveryAutoConfiguration,\ +org.apache.camel.component.consul.springboot.health.HealthCheckRepositoryAutoConfiguration \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-consul-starter/src/test/resources/application.properties ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-consul-starter/src/test/resources/application.properties b/platforms/spring-boot/components-starter/camel-consul-starter/src/test/resources/application.properties index 33406d2..2f91fc3 100644 --- a/platforms/spring-boot/components-starter/camel-consul-starter/src/test/resources/application.properties +++ b/platforms/spring-boot/components-starter/camel-consul-starter/src/test/resources/application.properties @@ -1 +1,17 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- spring.main.banner-mode=off http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java index a9c8bf3..ae1d3ac 100644 --- a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/java/org/apache/camel/component/servicenow/springboot/ServiceNowComponentConfiguration.java @@ -73,6 +73,22 @@ public class ServiceNowComponentConfiguration */ private String oauthTokenUrl; /** + * The proxy host name + */ + private String proxyHost; + /** + * The proxy port number + */ + private Integer proxyPort; + /** + * Username for proxy authentication + */ + private String proxyUserName; + /** + * Password for proxy authentication + */ + private String proxyPassword; + /** * Enable usage of global SSL context parameters. */ private Boolean useGlobalSslContextParameters = false; @@ -148,6 +164,38 @@ public class ServiceNowComponentConfiguration this.oauthTokenUrl = oauthTokenUrl; } + public String getProxyHost() { + return proxyHost; + } + + public void setProxyHost(String proxyHost) { + this.proxyHost = proxyHost; + } + + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer proxyPort) { + this.proxyPort = proxyPort; + } + + public String getProxyUserName() { + return proxyUserName; + } + + public void setProxyUserName(String proxyUserName) { + this.proxyUserName = proxyUserName; + } + + public String getProxyPassword() { + return proxyPassword; + } + + public void setProxyPassword(String proxyPassword) { + this.proxyPassword = proxyPassword; + } + public Boolean getUseGlobalSslContextParameters() { return useGlobalSslContextParameters; } http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories index e1b6c66..f75f320 100644 --- a/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-servicenow-starter/src/main/resources/META-INF/spring.factories @@ -15,4 +15,5 @@ ## limitations under the License. ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.servicenow.springboot.health.ServiceNowHealthAutoConfiguration,\ org.apache.camel.component.servicenow.springboot.ServiceNowComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/resources/META-INF/spring.factories ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/resources/META-INF/spring.factories b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/resources/META-INF/spring.factories index 8b4584c..037aaa1 100644 --- a/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/resources/META-INF/spring.factories +++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/main/resources/META-INF/spring.factories @@ -15,4 +15,5 @@ ## limitations under the License. ## --------------------------------------------------------------------------- org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +org.apache.camel.component.undertow.springboot.customizer.UndertowHealthAutoConfiguration,\ org.apache.camel.component.undertow.springboot.UndertowComponentAutoConfiguration http://git-wip-us.apache.org/repos/asf/camel/blob/00d1d70b/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/application.properties ---------------------------------------------------------------------- diff --git a/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/application.properties b/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/application.properties index d568c34..f56fcef 100644 --- a/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/application.properties +++ b/platforms/spring-boot/components-starter/camel-undertow-starter/src/test/resources/application.properties @@ -1 +1,17 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- spring.main.banner-mode = off \ No newline at end of file