camel git commit: CAMEL-11652 - Upgraded dozer to 6.1
Repository: camel Updated Branches: refs/heads/master a3d0df31d -> b1f8b6f91 CAMEL-11652 - Upgraded dozer to 6.1 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b1f8b6f9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b1f8b6f9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b1f8b6f9 Branch: refs/heads/master Commit: b1f8b6f91b1d2835194454cdf813acd68feb1809 Parents: a3d0df3 Author: Gareth HealyAuthored: Tue Aug 8 18:29:33 2017 +0100 Committer: Andrea Cosentino Committed: Wed Aug 9 07:56:58 2017 +0200 -- .../src/main/docs/dozer-component.adoc | 18 +- .../camel/component/dozer/DozerComponent.java | 27 +-- .../camel/component/dozer/DozerEndpoint.java| 103 -- .../dozer/DozerBeanMapperConfiguration.java | 12 ++ .../converter/dozer/DozerTypeConverter.java | 7 +- .../dozer/DozerTypeConverterLoader.java | 171 .../camel/converter/dozer/MapperFactory.java| 203 +++ .../dozer/DozerTestArtifactsFactory.java| 21 +- .../dozer/DozerTypeConverterDTOTest.java| 16 +- .../converter/dozer/DozerTypeConverterTest.java | 10 +- .../resources/application-context-map-id.xml| 12 +- .../src/test/resources/application-context.xml | 22 +- .../resources/bean-to-bean-dozer-mappings.xml | 5 +- .../resources/bean-to-map-dozer-mappings.xml| 5 +- .../src/test/resources/mapping-map-id.xml | 8 +- .../camel-dozer/src/test/resources/mapping.xml | 8 +- .../camel/component/dozer/customMapping.xml | 5 +- .../camel/component/dozer/dozerBeanMapping.xml | 5 +- .../camel/component/dozer/expressionMapping.xml | 5 +- .../dozer/expressionMappingClasspath.xml| 5 +- .../component/dozer/expressionMappingFile.xml | 5 +- .../camel/component/dozer/variableMapping.xml | 5 +- parent/pom.xml | 2 +- .../features/src/main/resources/features.xml| 1 + 24 files changed, 398 insertions(+), 283 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b1f8b6f9/components/camel-dozer/src/main/docs/dozer-component.adoc -- diff --git a/components/camel-dozer/src/main/docs/dozer-component.adoc b/components/camel-dozer/src/main/docs/dozer-component.adoc index e46f818..0b7f879 100644 --- a/components/camel-dozer/src/main/docs/dozer-component.adoc +++ b/components/camel-dozer/src/main/docs/dozer-component.adoc @@ -164,9 +164,9 @@ class into your target field of choice: [source,xml] - +http://dozermapper.github.io/schema/bean-mapping; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd;> ACME-SALES @@ -219,9 +219,9 @@ public class CustomMapper { [source,xml] - +http://dozermapper.github.io/schema/bean-mapping; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd;> org.example.A org.example.B @@ -254,9 +254,9 @@ An example of mapping a message header into a target field: [source,xml] -- - +http://dozermapper.github.io/schema/bean-mapping; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://dozermapper.github.io/schema/bean-mapping http://dozermapper.github.io/schema/bean-mapping.xsd;> org.apache.camel.component.dozer.ExpressionMapper org.example.B
[13/14] camel git commit: CAMEL-11331: Fix doc
CAMEL-11331: Fix doc Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4a0f8222 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4a0f8222 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4a0f8222 Branch: refs/heads/master Commit: 4a0f8222492bdc188574539862dcf845025363bd Parents: a722355 Author: Nicola FerraroAuthored: Tue Aug 8 12:40:24 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../src/main/docs/kubernetes-build-configs-component.adoc | 2 +- .../src/main/docs/kubernetes-builds-component.adoc | 2 +- .../camel-kubernetes/src/main/docs/kubernetes-component.adoc | 2 +- .../src/main/docs/kubernetes-config-maps-component.adoc| 2 +- .../src/main/docs/kubernetes-deployments-component.adoc| 2 +- .../src/main/docs/kubernetes-namespaces-component.adoc | 2 +- .../camel-kubernetes/src/main/docs/kubernetes-nodes-component.adoc | 2 +- .../main/docs/kubernetes-persistent-volumes-claims-component.adoc | 2 +- .../src/main/docs/kubernetes-persistent-volumes-component.adoc | 2 +- .../camel-kubernetes/src/main/docs/kubernetes-pods-component.adoc | 2 +- .../main/docs/kubernetes-replication-controllers-component.adoc| 2 +- .../src/main/docs/kubernetes-resources-quota-component.adoc| 2 +- .../src/main/docs/kubernetes-secrets-component.adoc| 2 +- .../src/main/docs/kubernetes-services-component.adoc | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/4a0f8222/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc -- diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc index 5acd8c3..b9ba15b 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc @@ -40,7 +40,7 @@ with the following path and query parameters: | **kubernetesClient** (producer) | Default KubernetesClient to use if provided | | KubernetesClient | **operation** (producer) | Producer operation to do on Kubernetes | | String | **portName** (producer) | The port name used for ServiceCall EIP | | String -| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the kubernetes API. | | Integer +| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the Kubernetes API server. | | Integer | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean | **caCertData** (security) | The CA Cert Data | | String | **caCertFile** (security) | The CA Cert File | | String http://git-wip-us.apache.org/repos/asf/camel/blob/4a0f8222/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc -- diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc index e5c73ed..6273f23 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc @@ -40,7 +40,7 @@ with the following path and query parameters: | **kubernetesClient** (producer) | Default KubernetesClient to use if provided | | KubernetesClient | **operation** (producer) | Producer operation to do on Kubernetes | | String | **portName** (producer) | The port name used for ServiceCall EIP | | String -| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the kubernetes API. | | Integer +| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the Kubernetes API server. | | Integer | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean | **caCertData** (security) | The CA Cert Data | | String | **caCertFile** (security) | The CA Cert File | | String http://git-wip-us.apache.org/repos/asf/camel/blob/4a0f8222/components/camel-kubernetes/src/main/docs/kubernetes-component.adoc -- diff --git
[14/14] camel git commit: CAMEL-11331: Added better logging and upgrade library
CAMEL-11331: Added better logging and upgrade library Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b0739238 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b0739238 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b0739238 Branch: refs/heads/master Commit: b073923867c77f62b63d5c7337327c0720fe6105 Parents: b72cf4d Author: Nicola FerraroAuthored: Tue Aug 1 10:30:26 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- components/camel-kubernetes/pom.xml | 6 ++-- .../kubernetes/ha/lock/TimedLeaderNotifier.java | 36 2 files changed, 24 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b0739238/components/camel-kubernetes/pom.xml -- diff --git a/components/camel-kubernetes/pom.xml b/components/camel-kubernetes/pom.xml index 38fa037..0d7b72b 100644 --- a/components/camel-kubernetes/pom.xml +++ b/components/camel-kubernetes/pom.xml @@ -44,14 +44,12 @@ io.fabric8 kubernetes-client - 2.3-SNAPSHOT - + ${kubernetes-client-version} io.fabric8 openshift-client - 2.3-SNAPSHOT - + ${kubernetes-client-version} http://git-wip-us.apache.org/repos/asf/camel/blob/b0739238/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/TimedLeaderNotifier.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/TimedLeaderNotifier.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/TimedLeaderNotifier.java index 6c51226..c95b517 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/TimedLeaderNotifier.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/TimedLeaderNotifier.java @@ -155,25 +155,33 @@ public class TimedLeaderNotifier implements Service { final Optional newLeader = leader; if (!newLeader.equals(lastCommunicatedLeader)) { lastCommunicatedLeader = newLeader; -LOG.debug("Communicating new leader: {}" + newLeader); -handler.onKubernetesClusterEvent(new KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent() { -@Override -public Optional getData() { -return newLeader; -} -}); +LOG.info("The cluster has a new leader: {}", newLeader); +try { +handler.onKubernetesClusterEvent(new KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent() { +@Override +public Optional getData() { +return newLeader; +} +}); +} catch (Throwable t) { +LOG.warn("Error while communicating the new leader to the handler", t); +} } final Set newMembers = members; if (!newMembers.equals(lastCommunicatedMembers)) { lastCommunicatedMembers = newMembers; -LOG.debug("Communicating new cluster members: {}" + newMembers); -handler.onKubernetesClusterEvent(new KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent() { -@Override -public Set getData() { -return newMembers; -} -}); +LOG.info("The list of cluster members has changed: {}", newMembers); +try { +handler.onKubernetesClusterEvent(new KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent() { +@Override +public Set getData() { +return newMembers; +} +}); +} catch (Throwable t) { +LOG.warn("Error while communicating the cluster members to the handler", t); +} } }
[06/14] camel git commit: CAMEL-11331: Lease based implementation of Kubernetes lock
CAMEL-11331: Lease based implementation of Kubernetes lock Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e4cab329 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e4cab329 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e4cab329 Branch: refs/heads/master Commit: e4cab32911c2d825568d1de93fbf42ccbc341c92 Parents: 4548126 Author: Nicola FerraroAuthored: Fri Jul 7 17:05:31 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../kubernetes/ha/KubernetesClusterService.java | 117 +- .../kubernetes/ha/KubernetesClusterView.java| 6 +- .../kubernetes/ha/lock/ConfigMapLockUtils.java | 106 ++ .../ha/lock/KubernetesLeaderMonitor.java| 256 - .../ha/lock/KubernetesLeadershipController.java | 211 --- ...ubernetesLeaseBasedLeadershipController.java | 374 +++ .../ha/lock/KubernetesLockConfiguration.java| 99 - .../ha/lock/KubernetesMembersMonitor.java | 4 +- .../kubernetes/ha/lock/LeaderInfo.java | 90 + 9 files changed, 767 insertions(+), 496 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/e4cab329/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java index 6d87d48..a868d16 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java @@ -19,6 +19,8 @@ package org.apache.camel.component.kubernetes.ha; import java.net.InetAddress; import java.util.Map; +import io.fabric8.kubernetes.client.KubernetesClient; + import org.apache.camel.CamelContext; import org.apache.camel.RuntimeCamelException; import org.apache.camel.component.kubernetes.KubernetesConfiguration; @@ -31,8 +33,6 @@ import org.apache.camel.util.ObjectHelper; */ public class KubernetesClusterService extends AbstractCamelClusterService { -public static final String DEFAULT_CONFIGMAP_NAME = "leaders"; - private KubernetesConfiguration configuration; private KubernetesLockConfiguration lockConfiguration; @@ -64,10 +64,7 @@ public class KubernetesClusterService extends AbstractCamelClusterService= 1 (found: " + config.getJitterFactor() + ")"); +} +if (config.getRetryOnErrorIntervalSeconds() <= 0) { +throw new IllegalStateException("retryOnErrorIntervalSeconds must be > 0 (found: " + config.getRetryOnErrorIntervalSeconds() + ")"); +} +if (config.getRetryPeriodSeconds() <= 0) { +throw new IllegalStateException("retryPeriodSeconds must be > 0 (found: " + config.getRetryPeriodSeconds() + ")"); +} +if (config.getRenewDeadlineSeconds() <= 0) { +throw new IllegalStateException("renewDeadlineSeconds must be > 0 (found: " + config.getRenewDeadlineSeconds() + ")"); +} +if (config.getLeaseDurationSeconds() <= 0) { +throw new IllegalStateException("leaseDurationSeconds must be > 0 (found: " + config.getLeaseDurationSeconds() + ")"); +} +if (config.getLeaseDurationSeconds() <= config.getRenewDeadlineSeconds()) { +throw new IllegalStateException("leaseDurationSeconds must be greater than renewDeadlineSeconds " ++ "(" + config.getLeaseDurationSeconds() + " is not greater than " + config.getRenewDeadlineSeconds() + ")"); +} +if (config.getRenewDeadlineSeconds() <= config.getJitterFactor() * config.getRetryPeriodSeconds()) { +throw new IllegalStateException("renewDeadlineSeconds must be greater than jitterFactor*retryPeriodSeconds " ++ "(" + config.getRenewDeadlineSeconds() + " is not greater than " + config.getJitterFactor() + "*" + config.getRetryPeriodSeconds() + ")"); +} + return config; } @@ -137,15 +161,88 @@ public class KubernetesClusterService extends AbstractCamelClusterServicehttp://git-wip-us.apache.org/repos/asf/camel/blob/e4cab329/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java
[12/14] camel git commit: CAMEL-11331: Fixed logging and avoid unnecessary wait
CAMEL-11331: Fixed logging and avoid unnecessary wait Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b72cf4d4 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b72cf4d4 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b72cf4d4 Branch: refs/heads/master Commit: b72cf4d48553bec5dae68e7f69feb9314683df11 Parents: 5d6fe41 Author: Nicola FerraroAuthored: Mon Jul 31 17:56:08 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../ha/lock/KubernetesLeadershipController.java | 22 ++-- .../kubernetes/ha/lock/TimedLeaderNotifier.java | 2 ++ 2 files changed, 13 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b72cf4d4/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java index b0c2110..2f79bd7 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java @@ -130,7 +130,7 @@ public class KubernetesLeadershipController implements Service { LOG.info("{} The cluster has no leaders. Trying to acquire the leadership...", logPrefix()); boolean acquired = tryAcquireLeadership(); if (acquired) { -LOG.info("{} Leadership acquired by current pod ({}) with immediate effect", logPrefix(), this.lockConfiguration.getPodName()); +LOG.info("{} Leadership acquired by current pod with immediate effect", logPrefix()); this.currentState = State.LEADER; this.serializedExecutor.execute(this::refreshStatus); return; @@ -142,7 +142,7 @@ public class KubernetesLeadershipController implements Service { LOG.info("{} Leadership has been lost by old owner. Trying to acquire the leadership...", logPrefix()); boolean acquired = tryAcquireLeadership(); if (acquired) { -LOG.info("{} Leadership acquired by current pod ({})", logPrefix(), this.lockConfiguration.getPodName()); +LOG.info("{} Leadership acquired by current pod", logPrefix()); this.currentState = State.BECOMING_LEADER; this.serializedExecutor.execute(this::refreshStatus); return; @@ -151,7 +151,7 @@ public class KubernetesLeadershipController implements Service { } } else if (this.latestLeaderInfo.isValidLeader(this.lockConfiguration.getPodName())) { // We are leaders for some reason (e.g. pod restart on failure) -LOG.info("{} Leadership is already owned by current pod ({})", logPrefix(), this.lockConfiguration.getPodName()); +LOG.info("{} Leadership is already owned by current pod", logPrefix()); this.currentState = State.BECOMING_LEADER; this.serializedExecutor.execute(this::refreshStatus); return; @@ -172,7 +172,7 @@ public class KubernetesLeadershipController implements Service { // Wait always the same amount of time before becoming the leader // Even if the current pod is already leader, we should let a possible old version of the pod to shut down long delay = this.lockConfiguration.getLeaseDurationMillis(); -LOG.info("{} Current pod ({}) owns the leadership, but it will be effective in {} seconds...", logPrefix(), this.lockConfiguration.getPodName(), new BigDecimal(delay).divide(BigDecimal +LOG.info("{} Current pod owns the leadership, but it will be effective in {} seconds...", logPrefix(), new BigDecimal(delay).divide(BigDecimal .valueOf(1000), 2, BigDecimal.ROUND_HALF_UP)); try { @@ -181,7 +181,7 @@ public class KubernetesLeadershipController implements Service { LOG.warn("Thread interrupted", e); } -LOG.info("{} Current pod ({}) is becoming the new leader now...", logPrefix(), this.lockConfiguration.getPodName()); +LOG.info("{} Current pod is becoming the new leader now...", logPrefix()); this.currentState = State.LEADER; this.serializedExecutor.execute(this::refreshStatus); } @@ -196,7 +196,7 @@ public class KubernetesLeadershipController
[07/14] camel git commit: CAMEL-11331: Adding clarifications to the leader interface and fix impl
CAMEL-11331: Adding clarifications to the leader interface and fix impl Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/debfeed6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/debfeed6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/debfeed6 Branch: refs/heads/master Commit: debfeed6ef0b45f725d4a20ea5d48a2f41fabec2 Parents: e4cab32 Author: Nicola FerraroAuthored: Fri Jul 7 17:18:05 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../camel/ha/CamelClusterEventListener.java | 29 ++-- .../kubernetes/ha/KubernetesClusterView.java| 4 +-- ...ubernetesLeaseBasedLeadershipController.java | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/debfeed6/camel-core/src/main/java/org/apache/camel/ha/CamelClusterEventListener.java -- diff --git a/camel-core/src/main/java/org/apache/camel/ha/CamelClusterEventListener.java b/camel-core/src/main/java/org/apache/camel/ha/CamelClusterEventListener.java index 5c19970..1a972ca 100644 --- a/camel-core/src/main/java/org/apache/camel/ha/CamelClusterEventListener.java +++ b/camel-core/src/main/java/org/apache/camel/ha/CamelClusterEventListener.java @@ -17,16 +17,39 @@ package org.apache.camel.ha; /** - * Marker interface + * Marker interface for cluster events */ public interface CamelClusterEventListener { interface Leadership extends CamelClusterEventListener { + +/** + * Notify a change in the leadership for a particular cluster. + * + * @param view the cluster view + * @param leader the new leader or null (when there are no active leaders) + */ void leadershipChanged(CamelClusterView view, CamelClusterMember leader); + } interface Membership extends CamelClusterEventListener { -void memberAdded(CamelClusterView view, CamelClusterMember leader); -void memberRemoved(CamelClusterView view, CamelClusterMember leader); + +/** + * Notify a change (addition) in the cluster composition. + * + * @param view the cluster view + * @param member the member that has been added + */ +void memberAdded(CamelClusterView view, CamelClusterMember member); + +/** + * Notify a change (removal) in the cluster composition. + * + * @param view the cluster view + * @param member the member that has been removed + */ +void memberRemoved(CamelClusterView view, CamelClusterMember member); + } } http://git-wip-us.apache.org/repos/asf/camel/blob/debfeed6/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java index e324b3f..28f38a5 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java @@ -91,9 +91,7 @@ public class KubernetesClusterView extends AbstractCamelClusterView { // New leader Optional leader = KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent.class.cast(event).getData(); currentLeader = leader.map(this::toMember); -if (currentLeader.isPresent()) { -fireLeadershipChangedEvent(currentLeader.get()); -} +fireLeadershipChangedEvent(currentLeader.orElse(null)); } else if (event instanceof KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent) { Set members = KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent.class.cast(event).getData(); Set oldMembers = currentMembers.stream().map(CamelClusterMember::getId).collect(Collectors.toSet()); http://git-wip-us.apache.org/repos/asf/camel/blob/debfeed6/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java
[01/14] camel git commit: CAMEL-11331: Using Camel thread pools
Repository: camel Updated Branches: refs/heads/master 9fc6d0bda -> a3d0df31d CAMEL-11331: Using Camel thread pools Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a3d0df31 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a3d0df31 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a3d0df31 Branch: refs/heads/master Commit: a3d0df31dc067d55adf7f654cd545f19a400341e Parents: 4a0f822 Author: Nicola FerraroAuthored: Tue Aug 8 15:39:22 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../kubernetes/ha/KubernetesClusterService.java | 2 +- .../component/kubernetes/ha/KubernetesClusterView.java | 12 .../ha/lock/KubernetesLeadershipController.java | 11 +++ .../kubernetes/ha/lock/TimedLeaderNotifier.java | 9 ++--- .../kubernetes/ha/KubernetesClusterServiceTest.java | 2 +- .../kubernetes/ha/TimedLeaderNotifierTest.java | 10 +- 6 files changed, 32 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a3d0df31/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java index 1c95b22..00cb04d 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java @@ -57,7 +57,7 @@ public class KubernetesClusterService extends AbstractCamelClusterServicehttp://git-wip-us.apache.org/repos/asf/camel/blob/a3d0df31/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java index ddda675..a67b662 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterView.java @@ -27,6 +27,7 @@ import java.util.stream.Collectors; import io.fabric8.kubernetes.client.KubernetesClient; +import org.apache.camel.CamelContext; import org.apache.camel.component.kubernetes.KubernetesConfiguration; import org.apache.camel.component.kubernetes.KubernetesHelper; import org.apache.camel.component.kubernetes.ha.lock.KubernetesClusterEvent; @@ -42,6 +43,8 @@ import org.apache.camel.util.ObjectHelper; */ public class KubernetesClusterView extends AbstractCamelClusterView { +private CamelContext camelContext; + private KubernetesClient kubernetesClient; private KubernetesConfiguration configuration; @@ -58,10 +61,11 @@ public class KubernetesClusterView extends AbstractCamelClusterView { private KubernetesLeadershipController controller; -public KubernetesClusterView(KubernetesClusterService cluster, KubernetesConfiguration configuration, KubernetesLockConfiguration lockConfiguration) { +public KubernetesClusterView(CamelContext camelContext, KubernetesClusterService cluster, KubernetesConfiguration configuration, KubernetesLockConfiguration lockConfiguration) { super(cluster, lockConfiguration.getGroupName()); -this.configuration = configuration; -this.lockConfiguration = lockConfiguration; +this.camelContext = ObjectHelper.notNull(camelContext, "camelContext"); +this.configuration = ObjectHelper.notNull(configuration, "configuration"); +this.lockConfiguration = ObjectHelper.notNull(lockConfiguration, "lockConfiguration"); this.localMember = new KubernetesClusterMember(lockConfiguration.getPodName()); this.memberCache = new HashMap<>(); } @@ -86,7 +90,7 @@ public class KubernetesClusterView extends AbstractCamelClusterView { if (controller == null) { this.kubernetesClient = KubernetesHelper.getKubernetesClient(configuration); -controller = new KubernetesLeadershipController(kubernetesClient, this.lockConfiguration, event -> { +controller = new KubernetesLeadershipController(camelContext, kubernetesClient,
[03/14] camel git commit: CAMEL-11331: Clock-drift-free version of the protocol
http://git-wip-us.apache.org/repos/asf/camel/blob/f0b00ab9/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/TimedLeaderNotifierTest.java -- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/TimedLeaderNotifierTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/TimedLeaderNotifierTest.java new file mode 100644 index 000..8380147 --- /dev/null +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/TimedLeaderNotifierTest.java @@ -0,0 +1,117 @@ +/** + * 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.kubernetes.ha; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Optional; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.camel.component.kubernetes.ha.lock.KubernetesClusterEvent; +import org.apache.camel.component.kubernetes.ha.lock.TimedLeaderNotifier; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +/** + * Test the behavior of the timed notifier. + */ +public class TimedLeaderNotifierTest { + +private TimedLeaderNotifier notifier; + +private volatile Optional currentLeader; + +private volatile Set currentMembers; + +@Before +public void init() throws Exception { +this.notifier = new TimedLeaderNotifier(e -> { +if (e instanceof KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent) { +currentLeader = ((KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent) e).getData(); +} else if (e instanceof KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent) { +currentMembers = ((KubernetesClusterEvent.KubernetesClusterMemberListChangedEvent) e).getData(); +} +}); +this.notifier.start(); +} + +@After +public void destroy() throws Exception { +this.notifier.stop(); +} + +@Test +public void testMultipleCalls() throws Exception { +Set members = new TreeSet<>(Arrays.asList("one", "two", "three")); +notifier.refreshLeadership(Optional.of("one"), System.currentTimeMillis(), 50L, members); +notifier.refreshLeadership(Optional.of("two"), System.currentTimeMillis(), 50L, members); +notifier.refreshLeadership(Optional.of("three"), System.currentTimeMillis(), 5000L, members); +Thread.sleep(80); +assertEquals(Optional.of("three"), currentLeader); +assertEquals(members, currentMembers); +} + +@Test +public void testExpiration() throws Exception { +Set members = new TreeSet<>(Arrays.asList("one", "two", "three")); +notifier.refreshLeadership(Optional.of("one"), System.currentTimeMillis(), 50L, members); +notifier.refreshLeadership(Optional.of("two"), System.currentTimeMillis(), 50L, members); +Thread.sleep(160); +assertEquals(Optional.empty(), currentLeader); +assertEquals(members, currentMembers); +notifier.refreshLeadership(Optional.of("three"), System.currentTimeMillis(), 5000L, members); +Thread.sleep(80); +assertEquals(Optional.of("three"), currentLeader); +assertEquals(members, currentMembers); +} + +@Test +public void testMemberChanging() throws Exception { +Set members1 = Collections.singleton("one"); +Set members2 = new TreeSet<>(Arrays.asList("one", "two")); +notifier.refreshLeadership(Optional.of("one"), System.currentTimeMillis(), 50L, members1); +notifier.refreshLeadership(Optional.of("two"), System.currentTimeMillis(), 5000L, members2); +Thread.sleep(80); +assertEquals(Optional.of("two"), currentLeader); +assertEquals(members2, currentMembers); +} + +@Test +public void testOldData() throws Exception { +Set members = new TreeSet<>(Arrays.asList("one", "two", "three")); +notifier.refreshLeadership(Optional.of("one"), System.currentTimeMillis(), 1000L, members); +
[11/14] camel git commit: CAMEL-11331: Removed unnecessary change in leadership for followers
CAMEL-11331: Removed unnecessary change in leadership for followers Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a0b23207 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a0b23207 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a0b23207 Branch: refs/heads/master Commit: a0b232073d368377994e26fe16a073b7ef058775 Parents: 41eec62 Author: Nicola FerraroAuthored: Wed Jul 19 16:34:51 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../ha/lock/KubernetesLeaseBasedLeadershipController.java | 9 + .../kubernetes/ha/KubernetesClusterServiceTest.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a0b23207/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java index 1366ee1..76e91bf 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java @@ -265,6 +265,7 @@ public class KubernetesLeaseBasedLeadershipController implements Service { LOG.debug("ConfigMap {} successfully created and local pod is leader", this.lockConfiguration.getConfigMapName()); updateLatestLeaderInfo(newConfigMap); +scheduleCheckForPossibleLeadershipLoss(); return true; } else { LOG.debug("Lock configmap already present in the Kubernetes namespace. Checking..."); @@ -285,6 +286,7 @@ public class KubernetesLeaseBasedLeadershipController implements Service { LOG.debug("ConfigMap {} successfully updated and local pod is leader", this.lockConfiguration.getConfigMapName()); updateLatestLeaderInfo(updatedConfigMap); +scheduleCheckForPossibleLeadershipLoss(); return true; } catch (Exception ex) { LOG.warn("An attempt to become leader has failed. It's possible that the leadership has been taken by another pod"); @@ -341,13 +343,12 @@ public class KubernetesLeaseBasedLeadershipController implements Service { private void updateLatestLeaderInfo(ConfigMap configMap) { LOG.debug("Updating internal status about the current leader"); this.latestLeaderInfo = ConfigMapLockUtils.getLeaderInfo(configMap, this.lockConfiguration.getGroupName()); +} -// Notify about changes in current leader if any -this.eventDispatcherExecutor.execute(this::checkAndNotifyNewLeader); +private void scheduleCheckForPossibleLeadershipLoss() { +// Adding check for the case of main thread busy on http calls if (this.latestLeaderInfo.isLeader(this.lockConfiguration.getPodName())) { this.eventDispatcherExecutor.schedule(this::checkAndNotifyNewLeader, this.lockConfiguration.getRenewDeadlineSeconds() * 1000 + FIXED_ADDITIONAL_DELAY, TimeUnit.MILLISECONDS); -} else if (this.latestLeaderInfo.getLeader() != null) { - this.eventDispatcherExecutor.schedule(this::checkAndNotifyNewLeader, this.lockConfiguration.getLeaseDurationSeconds() * 1000 + FIXED_ADDITIONAL_DELAY, TimeUnit.MILLISECONDS); } } http://git-wip-us.apache.org/repos/asf/camel/blob/a0b23207/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterServiceTest.java -- diff --git a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterServiceTest.java b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterServiceTest.java index 4baebc6..3bdffbd 100644 --- a/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterServiceTest.java +++ b/components/camel-kubernetes/src/test/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterServiceTest.java @@ -205,7 +205,7 @@ public class KubernetesClusterServiceTest extends CamelTestSupport { a1.waitForAnyLeader(2, TimeUnit.SECONDS); a2.waitForAnyLeader(2,
[04/14] camel git commit: CAMEL-11331: Clock-drift-free version of the protocol
CAMEL-11331: Clock-drift-free version of the protocol Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f0b00ab9 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f0b00ab9 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f0b00ab9 Branch: refs/heads/master Commit: f0b00ab927e9e55c238c8ea77e1b08c65335ca01 Parents: a0b2320 Author: Nicola FerraroAuthored: Mon Jul 31 17:17:34 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../kubernetes/ha/KubernetesClusterService.java | 84 ++-- .../kubernetes/ha/KubernetesClusterView.java| 6 +- .../kubernetes/ha/lock/ConfigMapLockUtils.java | 15 +- .../ha/lock/KubernetesLeadershipController.java | 352 + ...ubernetesLeaseBasedLeadershipController.java | 384 --- .../ha/lock/KubernetesLockConfiguration.java| 84 ++-- .../ha/lock/KubernetesMembersMonitor.java | 237 .../kubernetes/ha/lock/LeaderInfo.java | 46 ++- .../kubernetes/ha/lock/TimedLeaderNotifier.java | 179 + .../ha/KubernetesClusterServiceTest.java| 59 +-- .../kubernetes/ha/TimedLeaderNotifierTest.java | 117 ++ .../kubernetes/ha/utils/LeaderRecorder.java | 5 + .../kubernetes/ha/utils/LockTestServer.java | 31 +- 13 files changed, 813 insertions(+), 786 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/f0b00ab9/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java index a868d16..08ebb70 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/KubernetesClusterService.java @@ -82,25 +82,22 @@ public class KubernetesClusterService extends AbstractCamelClusterService= 1 (found: " + config.getJitterFactor() + ")"); } -if (config.getRetryOnErrorIntervalSeconds() <= 0) { -throw new IllegalStateException("retryOnErrorIntervalSeconds must be > 0 (found: " + config.getRetryOnErrorIntervalSeconds() + ")"); +if (config.getRetryPeriodMillis() <= 0) { +throw new IllegalStateException("retryPeriodMillis must be > 0 (found: " + config.getRetryPeriodMillis() + ")"); } -if (config.getRetryPeriodSeconds() <= 0) { -throw new IllegalStateException("retryPeriodSeconds must be > 0 (found: " + config.getRetryPeriodSeconds() + ")"); +if (config.getRenewDeadlineMillis() <= 0) { +throw new IllegalStateException("renewDeadlineMillis must be > 0 (found: " + config.getRenewDeadlineMillis() + ")"); } -if (config.getRenewDeadlineSeconds() <= 0) { -throw new IllegalStateException("renewDeadlineSeconds must be > 0 (found: " + config.getRenewDeadlineSeconds() + ")"); +if (config.getLeaseDurationMillis() <= 0) { +throw new IllegalStateException("leaseDurationMillis must be > 0 (found: " + config.getLeaseDurationMillis() + ")"); } -if (config.getLeaseDurationSeconds() <= 0) { -throw new IllegalStateException("leaseDurationSeconds must be > 0 (found: " + config.getLeaseDurationSeconds() + ")"); +if (config.getLeaseDurationMillis() <= config.getRenewDeadlineMillis()) { +throw new IllegalStateException("leaseDurationMillis must be greater than renewDeadlineMillis " ++ "(" + config.getLeaseDurationMillis() + " is not greater than " + config.getRenewDeadlineMillis() + ")"); } -if (config.getLeaseDurationSeconds() <= config.getRenewDeadlineSeconds()) { -throw new IllegalStateException("leaseDurationSeconds must be greater than renewDeadlineSeconds " -+ "(" + config.getLeaseDurationSeconds() + " is not greater than " + config.getRenewDeadlineSeconds() + ")"); -} -if (config.getRenewDeadlineSeconds() <= config.getJitterFactor() * config.getRetryPeriodSeconds()) { -throw new IllegalStateException("renewDeadlineSeconds must be greater than jitterFactor*retryPeriodSeconds " -+ "(" + config.getRenewDeadlineSeconds() + " is not greater than " + config.getJitterFactor() + "*" + config.getRetryPeriodSeconds() + ")"); +if (config.getRenewDeadlineMillis() <= config.getJitterFactor() *
[02/14] camel git commit: CAMEL-11331: Adding connection timeout as parameter (auto-computed)
CAMEL-11331: Adding connection timeout as parameter (auto-computed) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a722355b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a722355b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a722355b Branch: refs/heads/master Commit: a722355b04684b97f733c9d9845902097a77f4cf Parents: b073923 Author: Nicola FerraroAuthored: Tue Aug 8 12:05:59 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../kubernetes-build-configs-component.adoc | 3 +- .../main/docs/kubernetes-builds-component.adoc | 3 +- .../src/main/docs/kubernetes-component.adoc | 3 +- .../docs/kubernetes-config-maps-component.adoc | 3 +- .../docs/kubernetes-deployments-component.adoc | 3 +- .../docs/kubernetes-namespaces-component.adoc | 3 +- .../main/docs/kubernetes-nodes-component.adoc | 3 +- ...tes-persistent-volumes-claims-component.adoc | 3 +- ...kubernetes-persistent-volumes-component.adoc | 3 +- .../main/docs/kubernetes-pods-component.adoc| 3 +- ...netes-replication-controllers-component.adoc | 3 +- .../kubernetes-resources-quota-component.adoc | 3 +- .../main/docs/kubernetes-secrets-component.adoc | 3 +- .../docs/kubernetes-services-component.adoc | 3 +- .../kubernetes/KubernetesConfiguration.java | 16 ++- .../component/kubernetes/KubernetesHelper.java | 3 ++ .../kubernetes/ha/KubernetesClusterService.java | 30 ++-- 17 files changed, 73 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a722355b/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc -- diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc index d0029aa..5acd8c3 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-build-configs-component.adoc @@ -30,7 +30,7 @@ with the following path and query parameters: | **masterUrl** | *Required* Kubernetes Master url | | String |=== - Query Parameters (18 parameters): + Query Parameters (19 parameters): [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -40,6 +40,7 @@ with the following path and query parameters: | **kubernetesClient** (producer) | Default KubernetesClient to use if provided | | KubernetesClient | **operation** (producer) | Producer operation to do on Kubernetes | | String | **portName** (producer) | The port name used for ServiceCall EIP | | String +| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the kubernetes API. | | Integer | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean | **caCertData** (security) | The CA Cert Data | | String | **caCertFile** (security) | The CA Cert File | | String http://git-wip-us.apache.org/repos/asf/camel/blob/a722355b/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc -- diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc index 61714a7..e5c73ed 100644 --- a/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc +++ b/components/camel-kubernetes/src/main/docs/kubernetes-builds-component.adoc @@ -30,7 +30,7 @@ with the following path and query parameters: | **masterUrl** | *Required* Kubernetes Master url | | String |=== - Query Parameters (18 parameters): + Query Parameters (19 parameters): [width="100%",cols="2,5,^1,2",options="header"] |=== @@ -40,6 +40,7 @@ with the following path and query parameters: | **kubernetesClient** (producer) | Default KubernetesClient to use if provided | | KubernetesClient | **operation** (producer) | Producer operation to do on Kubernetes | | String | **portName** (producer) | The port name used for ServiceCall EIP | | String +| **connectionTimeout** (advanced) | Connection timeout in milliseconds to use when making requests to the kubernetes API. |
[08/14] camel git commit: CAMEL-11331: Adding tests and fixing impl
CAMEL-11331: Adding tests and fixing impl Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/881b9331 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/881b9331 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/881b9331 Branch: refs/heads/master Commit: 881b9331f0712b4e611087eb11e623016dd3de72 Parents: debfeed Author: Nicola FerraroAuthored: Fri Jul 14 11:21:50 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- components/camel-kubernetes/pom.xml | 6 + .../kubernetes/ha/lock/ConfigMapLockUtils.java | 2 +- ...ubernetesLeaseBasedLeadershipController.java | 15 +- .../ha/lock/KubernetesLockConfiguration.java| 6 +- .../ha/KubernetesClusterServiceTest.java| 291 +++ .../ha/utils/ConfigMapLockSimulator.java| 83 ++ .../kubernetes/ha/utils/LeaderRecorder.java | 115 .../kubernetes/ha/utils/LockTestServer.java | 175 +++ .../kubernetes/ha/utils/LockTestServerTest.java | 97 +++ parent/pom.xml | 1 + 10 files changed, 784 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/881b9331/components/camel-kubernetes/pom.xml -- diff --git a/components/camel-kubernetes/pom.xml b/components/camel-kubernetes/pom.xml index c444068..38fa037 100644 --- a/components/camel-kubernetes/pom.xml +++ b/components/camel-kubernetes/pom.xml @@ -67,6 +67,12 @@ test + io.fabric8 + mockwebserver + ${mockwebserver-version} + test + + org.apache.camel camel-test-spring test http://git-wip-us.apache.org/repos/asf/camel/blob/881b9331/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/ConfigMapLockUtils.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/ConfigMapLockUtils.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/ConfigMapLockUtils.java index 84718f3..70fa860 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/ConfigMapLockUtils.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/ConfigMapLockUtils.java @@ -26,7 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * Utilities for managing ConfigMaps that contain lock information. */ public final class ConfigMapLockUtils { http://git-wip-us.apache.org/repos/asf/camel/blob/881b9331/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java index 8e96a72..42be2e7 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java @@ -163,8 +163,9 @@ public class KubernetesLeaseBasedLeadershipController implements Service { long time = Math.min(timeRetry, timeDeadline); long delay = Math.max(0, time - System.currentTimeMillis()); -LOG.debug("Next renewal timeout event will be fired in {} seconds", delay / 1000); -return delay; +long delayJittered = jitter(delay, lockConfiguration.getJitterFactor()); +LOG.debug("Next renewal timeout event will be fired in {} seconds", delayJittered / 1000); +return delayJittered; } @@ -340,10 +341,18 @@ public class KubernetesLeaseBasedLeadershipController implements Service { private void updateLatestLeaderInfo(ConfigMap configMap) { LOG.debug("Updating internal status about the current leader"); this.latestLeaderInfo = ConfigMapLockUtils.getLeaderInfo(configMap, this.lockConfiguration.getGroupName()); + +// Notify about changes in current leader if any +this.eventDispatcherExecutor.execute(this::checkAndNotifyNewLeader); +if (this.latestLeaderInfo.isLeader(this.lockConfiguration.getPodName())) { +
[09/14] camel git commit: CAMEL-11331: Adjusted log level
CAMEL-11331: Adjusted log level Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/41eec628 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/41eec628 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/41eec628 Branch: refs/heads/master Commit: 41eec6282528c110def5b2af9921993bb11dac53 Parents: 881b933 Author: Nicola FerraroAuthored: Wed Jul 19 15:24:48 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../ha/lock/KubernetesLeaseBasedLeadershipController.java| 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/41eec628/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java index 42be2e7..1366ee1 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeaseBasedLeadershipController.java @@ -352,7 +352,7 @@ public class KubernetesLeaseBasedLeadershipController implements Service { } private void checkAndNotifyNewLeader() { -LOG.info("Checking if the current leader has changed to notify the event handler..."); +LOG.debug("Checking if the current leader has changed to notify the event handler..."); LeaderInfo newLeaderInfo = this.latestLeaderInfo; if (newLeaderInfo == null) { return; @@ -371,7 +371,7 @@ public class KubernetesLeaseBasedLeadershipController implements Service { // Sending notifications in case of leader change if (!newLeader.equals(this.currentLeader)) { -LOG.info("Current leader has changed from {} to {}. Sending notifications...", this.currentLeader, newLeader); +LOG.info("Current leader has changed from {} to {}. Sending notification...", this.currentLeader, newLeader); this.currentLeader = newLeader; eventHandler.onKubernetesClusterEvent((KubernetesClusterEvent.KubernetesClusterLeaderChangedEvent) () -> newLeader); } else {
[10/14] camel git commit: CAMEL-11331: Speeding up default config
CAMEL-11331: Speeding up default config Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d6fe415 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d6fe415 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d6fe415 Branch: refs/heads/master Commit: 5d6fe41536e87755453832efc46e32ba271dd20b Parents: f0b00ab Author: Nicola FerraroAuthored: Mon Jul 31 17:40:53 2017 +0200 Committer: Nicola Ferraro Committed: Tue Aug 8 16:39:43 2017 +0200 -- .../kubernetes/ha/lock/KubernetesLeadershipController.java | 2 +- .../kubernetes/ha/lock/KubernetesLockConfiguration.java| 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5d6fe415/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java index f527779..b0c2110 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLeadershipController.java @@ -346,7 +346,7 @@ public class KubernetesLeadershipController implements Service { } private String logPrefix() { -return "Leadership Controller [" + this.lockConfiguration.getPodName() + "]"; +return "Pod[" + this.lockConfiguration.getPodName() + "]"; } } http://git-wip-us.apache.org/repos/asf/camel/blob/5d6fe415/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLockConfiguration.java -- diff --git a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLockConfiguration.java b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLockConfiguration.java index be0b424..69c54d9 100644 --- a/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLockConfiguration.java +++ b/components/camel-kubernetes/src/main/java/org/apache/camel/component/kubernetes/ha/lock/KubernetesLockConfiguration.java @@ -29,9 +29,9 @@ public class KubernetesLockConfiguration implements Cloneable { public static final String DEFAULT_CONFIGMAP_NAME = "leaders"; public static final double DEFAULT_JITTER_FACTOR = 1.2; -public static final long DEFAULT_LEASE_DURATION_MILLIS = 6; -public static final long DEFAULT_RENEW_DEADLINE_MILLIS = 45000; -public static final long DEFAULT_RETRY_PERIOD_MILLIS = 9000; +public static final long DEFAULT_LEASE_DURATION_MILLIS = 3; +public static final long DEFAULT_RENEW_DEADLINE_MILLIS = 2; +public static final long DEFAULT_RETRY_PERIOD_MILLIS = 5000; /** * Kubernetes namespace containing the pods and the ConfigMap used for locking.
camel git commit: Fix CS
Repository: camel Updated Branches: refs/heads/master 43ca13886 -> 9fc6d0bda Fix CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9fc6d0bd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9fc6d0bd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9fc6d0bd Branch: refs/heads/master Commit: 9fc6d0bda4d44b5d0c424afe68b4911e59af857e Parents: 43ca138 Author: lburgazzoliAuthored: Tue Aug 8 14:59:09 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 14:59:09 2017 +0200 -- .../apache/camel/management/DefaultManagementNamingStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/9fc6d0bd/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java -- diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java index 341b9e9..c78c22b 100644 --- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java +++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementNamingStrategy.java @@ -52,7 +52,7 @@ public class DefaultManagementNamingStrategy implements ManagementNamingStrategy public static final String KEY_TYPE = "type"; public static final String KEY_CONTEXT = "context"; public static final String TYPE_CONTEXT = "context"; -public static final String TYPE_ROUTE_CONTROLLER= "routecontroller"; +public static final String TYPE_ROUTE_CONTROLLER = "routecontroller"; public static final String TYPE_ENDPOINT = "endpoints"; public static final String TYPE_DATAFORMAT = "dataformats"; public static final String TYPE_PROCESSOR = "processors";
camel git commit: CAMEL-11649 - Cookie Handling only works for one cookie
Repository: camel Updated Branches: refs/heads/camel-2.19.x b99ee3fdf -> a32d23124 CAMEL-11649 - Cookie Handling only works for one cookie Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a32d2312 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a32d2312 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a32d2312 Branch: refs/heads/camel-2.19.x Commit: a32d2312471b69b7bb0da5e9abf3f86c3e486f85 Parents: b99ee3f Author: Stephan SianoAuthored: Tue Aug 8 12:42:59 2017 +0200 Committer: Stephan Siano Committed: Tue Aug 8 13:54:50 2017 +0200 -- .../camel/component/ahc/DefaultAhcBinding.java | 24 +++- .../component/ahc/AhcProducerSessionTest.java | 2 ++ 2 files changed, 15 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a32d2312/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java -- diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java index dae132b..2e5c3d9 100644 --- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java +++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java @@ -25,12 +25,12 @@ import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.nio.charset.Charset; -import java.util.Collections; -import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.TreeMap; import org.apache.camel.CamelExchangeException; import org.apache.camel.Exchange; @@ -128,11 +128,11 @@ public class DefaultAhcBinding implements AhcBinding { Map cookieHeaders = endpoint.getCookieHandler().loadCookies(exchange, uri); for (Map.Entry entry : cookieHeaders.entrySet()) { String key = entry.getKey(); -if (entry.getValue().size() > 0) { -// use the default toString of a ArrayList to create in the form [xxx, yyy] -// if multi valued, for a single value, then just output the value as is -String s = entry.getValue().size() > 1 ? entry.getValue().toString() : entry.getValue().get(0); -builder.addHeader(key, s); +for (String value : entry.getValue()) { +if (log.isTraceEnabled()) { +log.trace("Adding header {} = {}", key, value); +} +builder.addHeader(key, value); } } } catch (IOException e) { @@ -233,13 +233,15 @@ public class DefaultAhcBinding implements AhcBinding { @Override public void onHeadersReceived(AhcEndpoint endpoint, Exchange exchange, HttpResponseHeaders headers) throws Exception { -List > l = headers.getHeaders().entries(); -Map m = new HashMap (); +Map m = new TreeMap (String.CASE_INSENSITIVE_ORDER); for (Entry entry : headers.getHeaders().entries()) { String key = entry.getKey(); String value = entry.getValue(); -m.put(key, Collections.singletonList(value)); -exchange.getOut().getHeaders().put(key, value); +if (!m.containsKey(key)) { +m.put(key, new LinkedList()); +exchange.getOut().getHeaders().put(key, value); +} +m.get(key).add(value); } // handle cookies if (endpoint.getCookieHandler() != null) { http://git-wip-us.apache.org/repos/asf/camel/blob/a32d2312/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java -- diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java index ca9bebe..95b519a 100644 --- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java +++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.ahc; +import
[05/10] camel git commit: CAMEL-11587: SupervisingRouteController : add option for initial delay
CAMEL-11587: SupervisingRouteController : add option for initial delay Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ef5aa1f5 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ef5aa1f5 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ef5aa1f5 Branch: refs/heads/master Commit: ef5aa1f561a6ad4fcbf7d8b95d6ef3c4c0b39e5a Parents: b3ebc7b Author: lburgazzoliAuthored: Mon Aug 7 11:20:01 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:28 2017 +0200 -- .../camel/impl/SupervisingRouteController.java | 83 +--- ...rvisingRouteControllerAutoConfiguration.java | 4 + ...SupervisingRouteControllerConfiguration.java | 15 .../src/main/resources/application.properties | 1 + 4 files changed, 94 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/ef5aa1f5/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java index 01396dc..8e5167e 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java @@ -16,6 +16,7 @@ */ package org.apache.camel.impl; +import java.time.Duration; import java.util.EventObject; import java.util.HashMap; import java.util.List; @@ -74,6 +75,7 @@ public class SupervisingRouteController extends DefaultRouteController { private ScheduledExecutorService executorService; private BackOff defaultBackOff; private Map backOffConfigurations; +private Duration initialDelay; public SupervisingRouteController() { this.lock = new Object(); @@ -83,6 +85,7 @@ public class SupervisingRouteController extends DefaultRouteController { this.routeManager = new RouteManager(); this.defaultBackOff = BackOff.builder().build(); this.backOffConfigurations = new HashMap<>(); +this.initialDelay = Duration.ofMillis(0); try { this.listener = new CamelContextStartupListener(); @@ -100,6 +103,9 @@ public class SupervisingRouteController extends DefaultRouteController { return defaultBackOff; } +/** + * Sets the default back-off. + */ public void setDefaultBackOff(BackOff defaultBackOff) { this.defaultBackOff = defaultBackOff; } @@ -108,6 +114,9 @@ public class SupervisingRouteController extends DefaultRouteController { return backOffConfigurations; } +/** + * Set the back-off for the given IDs. + */ public void setBackOffConfigurations(Map backOffConfigurations) { this.backOffConfigurations = backOffConfigurations; } @@ -116,10 +125,47 @@ public class SupervisingRouteController extends DefaultRouteController { return backOffConfigurations.getOrDefault(id, defaultBackOff); } +/** + * Sets the back-off to be applied to the given id. + */ public void setBackOff(String id, BackOff backOff) { backOffConfigurations.put(id, backOff); } +public Duration getInitialDelay() { +return initialDelay; +} + +/** + * Set the amount of time the route controller should wait before to start + * the routes after the camel context is started or after the route is + * initialized if the route is created after the camel context is started. + * + * @param initialDelay the initial delay. + */ +public void setInitialDelay(Duration initialDelay) { +this.initialDelay = initialDelay; +} + +/** + * #see {@link this#setInitialDelay(Duration)} + * + * @param initialDelay the initial delay amount. + * @param initialDelay the initial delay time unit. + */ +public void setInitialDelay(long initialDelay, TimeUnit initialDelayUnit) { +this.initialDelay = Duration.ofMillis(initialDelayUnit.toMillis(initialDelay)); +} + +/** + * #see {@link this#setInitialDelay(Duration)} + * + * @param initialDelay the initial delay in milliseconds. + */ +public void setInitialDelay(long initialDelay) { +this.initialDelay = Duration.ofMillis(initialDelay); +} + // * // Lifecycle // * @@ -535,6 +581,19 @@ public class SupervisingRouteController extends DefaultRouteController { } private class ManagedRoutePolicy implements RoutePolicy { + +private void
[07/10] camel git commit: CAMEL-11582: SupervisingRouteController should have better INFO logging on startup
CAMEL-11582: SupervisingRouteController should have better INFO logging on startup Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a25eb775 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a25eb775 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a25eb775 Branch: refs/heads/master Commit: a25eb7753ab3a3e03add7455d45e4c1fadb7ab1b Parents: 04f0706 Author: lburgazzoliAuthored: Mon Aug 7 08:59:26 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:28 2017 +0200 -- .../org/apache/camel/impl/SupervisingRouteController.java | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a25eb775/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java index 669532e..01396dc 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java @@ -335,6 +335,12 @@ public class SupervisingRouteController extends DefaultRouteController { // ignored, exception handled by startRoute } } + +LOGGER.info("Total managed routes: {} of which {} successfully started and {} re-starting", +routes.size(), +routes.stream().filter(r -> r.getStatus() == ServiceStatus.Started).count(), +routeManager.routes.size() +); } private synchronized void stopRoutes() { @@ -542,7 +548,7 @@ public class SupervisingRouteController extends DefaultRouteController { holder.getDefinition().setAutoStartup("false"); if (contextStarted.get()) { -LOGGER.debug("Context is started: attempt to start route {}", route.getId()); +LOGGER.info("Context is already started: attempt to start route {}", route.getId()); try { SupervisingRouteController.this.doStartRoute( holder, @@ -553,7 +559,7 @@ public class SupervisingRouteController extends DefaultRouteController { throw new RuntimeCamelException(e); } } else { -LOGGER.debug("Context is not started: add route {} to stopped routes", holder.getId()); +LOGGER.info("Context is not yet started: defer route {} start", holder.getId()); } } }
[04/10] camel git commit: CAMEL-11583: SupervisingRouteController should honor if a route was explicit set to autoStartup=false
CAMEL-11583: SupervisingRouteController should honor if a route was explicit set to autoStartup=false Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6893a37f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6893a37f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6893a37f Branch: refs/heads/master Commit: 6893a37f28c82dbc70a05b7cebc720fa40c641cf Parents: 0be3d90 Author: lburgazzoliAuthored: Fri Aug 4 17:53:07 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:27 2017 +0200 -- .../apache/camel/impl/DefaultCamelContext.java | 17 +++- .../camel/impl/DefaultRouteController.java | 5 + .../camel/impl/SupervisingRouteController.java | 21 +++- .../org/apache/camel/spi/RouteController.java | 9 + .../java/sample/camel/ApplicationRoutes.java| 5 + 5 files changed, 47 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/6893a37f/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index b46b6c2..1856ebd 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -3170,7 +3170,22 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon started++; } } -log.info("Total " + getRoutes().size() + " routes, of which " + started + " are started."); + +final List controlledRoutes = getRouteController().getControlledRoutes(); + +if (controlledRoutes.isEmpty()) { +log.info("Total {} routes, of which {} are started", +getRoutes().size(), +started); +} else { +log.info("Total {} routes, of which {} are started and {} are managed by the route controller ({})", +getRoutes().size(), +started, +controlledRoutes.size(), +getRouteController().getClass().getName() +); +} + log.info("Apache Camel " + getVersion() + " (CamelContext: " + getName() + ") started in " + TimeUtils.printDuration(stopWatch.taken())); } EventHelper.notifyCamelContextStarted(this); http://git-wip-us.apache.org/repos/asf/camel/blob/6893a37f/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java index ff51cf3..db10a33 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java @@ -17,6 +17,7 @@ package org.apache.camel.impl; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; @@ -104,4 +105,8 @@ public class DefaultRouteController extends org.apache.camel.support.ServiceSupp camelContext.resumeRoute(routeId); } +@Override +public List getControlledRoutes() { +return Collections.emptyList(); +} } http://git-wip-us.apache.org/repos/asf/camel/blob/6893a37f/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java index aaa6796..669532e 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java @@ -16,7 +16,6 @@ */ package org.apache.camel.impl; -import java.util.Collection; import java.util.EventObject; import java.util.HashMap; import java.util.List; @@ -252,6 +251,13 @@ public class SupervisingRouteController extends DefaultRouteController { } } +@Override +public List getControlledRoutes() { +return routes.stream() +.map(RouteHolder::get) +.collect(Collectors.toList()); +} + //
[09/10] camel git commit: CAMEL-11640: SupervisingRouteController : Add a SPI to filter routes to supervise
CAMEL-11640: SupervisingRouteController : Add a SPI to filter routes to supervise Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2b832e93 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2b832e93 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2b832e93 Branch: refs/heads/master Commit: 2b832e937e0a1cdd3a8037880a90d0261b0f4804 Parents: ef5aa1f Author: lburgazzoliAuthored: Mon Aug 7 12:04:27 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:29 2017 +0200 -- .../apache/camel/impl/DefaultCamelContext.java | 2 +- .../camel/impl/DefaultRouteController.java | 12 ++-- .../camel/impl/SupervisingRouteController.java | 75 +++- .../impl/SupervisingRouteControllerFilters.java | 51 + .../org/apache/camel/spi/RouteController.java | 15 ++-- ...rvisingRouteControllerAutoConfiguration.java | 25 +-- ...SupervisingRouteControllerConfiguration.java | 13 .../java/sample/camel/ApplicationRoutes.java| 8 ++- .../src/main/resources/application.properties | 4 +- 9 files changed, 177 insertions(+), 28 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/2b832e93/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java index 1856ebd..61939b8 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java @@ -3171,7 +3171,7 @@ public class DefaultCamelContext extends ServiceSupport implements ModelCamelCon } } -final List controlledRoutes = getRouteController().getControlledRoutes(); +final Collection controlledRoutes = getRouteController().getControlledRoutes(); if (controlledRoutes.isEmpty()) { log.info("Total {} routes, of which {} are started", http://git-wip-us.apache.org/repos/asf/camel/blob/2b832e93/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java index db10a33..6d46adc 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteController.java @@ -16,9 +16,8 @@ */ package org.apache.camel.impl; -import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.concurrent.TimeUnit; import org.apache.camel.CamelContext; @@ -28,16 +27,13 @@ import org.apache.camel.spi.RouteController; @Experimental public class DefaultRouteController extends org.apache.camel.support.ServiceSupport implements RouteController { -private final List routes; private CamelContext camelContext; - public DefaultRouteController() { this(null); } public DefaultRouteController(CamelContext camelContext) { this.camelContext = camelContext; -this.routes = new ArrayList<>(); } // *** @@ -105,8 +101,12 @@ public class DefaultRouteController extends org.apache.camel.support.ServiceSupp camelContext.resumeRoute(routeId); } +// *** +// +// *** + @Override -public List getControlledRoutes() { +public Collection getControlledRoutes() { return Collections.emptyList(); } } http://git-wip-us.apache.org/repos/asf/camel/blob/2b832e93/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java index 8e5167e..3054ac4 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java @@ -17,6 +17,9 @@ package org.apache.camel.impl; import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; import java.util.EventObject; import
[06/10] camel git commit: CAMEL-11578: Add javadoc to util.backoff
CAMEL-11578: Add javadoc to util.backoff Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/04f07062 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/04f07062 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/04f07062 Branch: refs/heads/master Commit: 04f07062eb928fe53e40362f67f42b4b53e19f00 Parents: 29a3b28 Author: lburgazzoliAuthored: Mon Aug 7 08:37:04 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:28 2017 +0200 -- .../org/apache/camel/util/backoff/BackOff.java | 34 .../camel/util/backoff/BackOffContext.java | 31 +- .../apache/camel/util/backoff/BackOffTimer.java | 9 +- ...SupervisingRouteControllerConfiguration.java | 2 +- 4 files changed, 73 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/04f07062/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java b/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java index 1e3d326..f38c957 100644 --- a/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java +++ b/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java @@ -21,6 +21,9 @@ import java.util.concurrent.TimeUnit; import org.apache.camel.util.ObjectHelper; +/** + * A back-off policy. + */ public final class BackOff { public static final long NEVER = -1L; public static final Duration MAX_DURATION = Duration.ofMillis(Long.MAX_VALUE); @@ -49,10 +52,16 @@ public final class BackOff { // Properties // * +/** + * @return the delay to wait before retry the operation. + */ public Duration getDelay() { return delay; } +/** + * The delay to wait before retry the operation. + */ public void setDelay(Duration delay) { this.delay = delay; } @@ -61,6 +70,9 @@ public final class BackOff { return maxDelay; } +/** + * The maximum back-off time after which the delay is not more increased. + */ public void setMaxDelay(Duration maxDelay) { this.maxDelay = maxDelay; } @@ -69,6 +81,10 @@ public final class BackOff { return maxElapsedTime; } +/** + * The maximum elapsed time after which the back-off should be considered + * exhausted and no more attempts should be made. + */ public void setMaxElapsedTime(Duration maxElapsedTime) { this.maxElapsedTime = maxElapsedTime; } @@ -77,6 +93,12 @@ public final class BackOff { return maxAttempts; } +/** + * The maximum number of attempts after which the back-off should be considered + * exhausted and no more attempts should be made. + * + * @param maxAttempts + */ public void setMaxAttempts(Long maxAttempts) { this.maxAttempts = maxAttempts; } @@ -85,6 +107,9 @@ public final class BackOff { return multiplier; } +/** + * The value to multiply the current interval by for each retry attempt. + */ public void setMultiplier(Double multiplier) { this.multiplier = multiplier; } @@ -108,6 +133,9 @@ public final class BackOff { return new Builder(); } +/** + * A builder for {@link BackOff} + */ public static final class Builder { private Duration delay = BackOff.DEFAULT_DELAY; private Duration maxDelay = BackOff.MAX_DURATION; @@ -115,6 +143,9 @@ public final class BackOff { private Long maxAttempts = Long.MAX_VALUE; private Double multiplier = BackOff.DEFAULT_MULTIPLIER; +/** + * Read values from the given {@link BackOff} + */ public Builder read(BackOff template) { delay = template.delay; maxDelay = template.maxDelay; @@ -174,6 +205,9 @@ public final class BackOff { return this; } +/** + * Build a new instance of {@link BackOff} + */ public BackOff build() { return new BackOff(delay, maxDelay, maxElapsedTime, maxAttempts, multiplier); } http://git-wip-us.apache.org/repos/asf/camel/blob/04f07062/camel-core/src/main/java/org/apache/camel/util/backoff/BackOffContext.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/backoff/BackOffContext.java b/camel-core/src/main/java/org/apache/camel/util/backoff/BackOffContext.java index 502f0ad..cd46653 100644 ---
[03/10] camel git commit: CAMEL-11581: SupervisingRouteController should have spring-boot auto configuration
CAMEL-11581: SupervisingRouteController should have spring-boot auto configuration Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b354cba3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b354cba3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b354cba3 Branch: refs/heads/master Commit: b354cba3f9af46490754ceb8668e6f7259a38183 Parents: 6893a37 Author: lburgazzoliAuthored: Fri Aug 4 18:03:50 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:27 2017 +0200 -- ...rvisingRouteControllerAutoConfiguration.java | 78 + ...SupervisingRouteControllerConfiguration.java | 109 +++ .../main/resources/META-INF/spring.factories| 1 + ...rvisingRouteControllerAutoConfiguration.java | 79 -- ...SupervisingRouteControllerConfiguration.java | 109 --- .../main/resources/META-INF/spring.factories| 1 - 6 files changed, 188 insertions(+), 189 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b354cba3/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java new file mode 100644 index 000..7382c6f --- /dev/null +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java @@ -0,0 +1,78 @@ +/** + * 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.spring.boot; + +import java.util.Map; +import java.util.Optional; + +import org.apache.camel.converter.TimePatternConverter; +import org.apache.camel.impl.SupervisingRouteController; +import org.apache.camel.spi.RouteController; +import org.apache.camel.spring.boot.SupervisingRouteControllerConfiguration.BackOffConfiguration; +import org.apache.camel.spring.boot.SupervisingRouteControllerConfiguration.RouteConfiguration; +import org.apache.camel.util.backoff.BackOff; +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.Scope; + +@Configuration +@AutoConfigureBefore(CamelAutoConfiguration.class) +@ConditionalOnProperty(prefix = "camel.supervising.controller", name = "enabled") +@EnableConfigurationProperties(SupervisingRouteControllerConfiguration.class) +public class SupervisingRouteControllerAutoConfiguration { +@Autowired +private SupervisingRouteControllerConfiguration configuration; + +@Bean +@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON) +@ConditionalOnMissingBean +public RouteController routeController() { +SupervisingRouteController controller = new SupervisingRouteController(); + +controller.setDefaultBackOff(configureBackOff(Optional.empty(), configuration.getBackOff())); + +for (Map.Entry entry: configuration.getRoutes().entrySet()) { +controller.setBackOff( +entry.getKey(), +configureBackOff( +Optional.ofNullable(controller.getDefaultBackOff()), +entry.getValue().getBackOff() +) +); +} + +return controller; +} + +
[10/10] camel git commit: CAMEL-11580: Add JMX api RouteController and SupervisingRouteController
CAMEL-11580: Add JMX api RouteController and SupervisingRouteController Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/43ca1388 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/43ca1388 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/43ca1388 Branch: refs/heads/master Commit: 43ca138867997d4997dadd30db080aef7bc9ef2d Parents: 2b832e9 Author: lburgazzoliAuthored: Mon Aug 7 17:08:44 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:29 2017 +0200 -- .../mbean/ManagedRouteControllerMBean.java | 27 +++ .../DefaultManagementLifecycleStrategy.java | 22 ++ .../DefaultManagementNamingStrategy.java| 18 + .../DefaultManagementObjectStrategy.java| 7 ++ .../management/ManagedManagementStrategy.java | 4 + .../mbean/ManagedRouteController.java | 57 ++ .../camel/spi/ManagementNamingStrategy.java | 2 + .../camel/spi/ManagementObjectStrategy.java | 2 + .../endpoint/CamelRouteControllerEndpoint.java | 60 +++ ...outeControllerEndpointAutoConfiguration.java | 49 .../CamelRouteControllerMvcEndpoint.java| 79 .../main/resources/META-INF/spring.factories| 1 + 12 files changed, 328 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java -- diff --git a/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java new file mode 100644 index 000..4422ed8 --- /dev/null +++ b/camel-core/src/main/java/org/apache/camel/api/management/mbean/ManagedRouteControllerMBean.java @@ -0,0 +1,27 @@ +/** + * 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.api.management.mbean; + +import java.util.Collection; + +import org.apache.camel.api.management.ManagedAttribute; + +public interface ManagedRouteControllerMBean { + +@ManagedAttribute(description = "Controlled Routes") +Collection getControlledRoutes(); +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/43ca1388/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java -- diff --git a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java index 9a70390..3cf6f09 100644 --- a/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java +++ b/camel-core/src/main/java/org/apache/camel/management/DefaultManagementLifecycleStrategy.java @@ -219,6 +219,17 @@ public class DefaultManagementLifecycleStrategy extends ServiceSupport implement // register any pre registered now that we are initialized enlistPreRegisteredServices(); + +try { +Object me = getManagementObjectStrategy().getManagedObjectForRouteController(camelContext); +if (me == null) { +// endpoint should not be managed +return; +} +manageObject(me); +} catch (Exception e) { +LOG.warn("Could not register RouteController MBean. This exception will be ignored.", e); +} } private String findFreeName(Object mc, ManagementNameStrategy strategy, String name) throws MalformedObjectNameException { @@ -276,6 +287,17 @@ public class DefaultManagementLifecycleStrategy extends ServiceSupport implement if (!initialized) { return; } + +try { +Object mc = getManagementObjectStrategy().getManagedObjectForRouteController(context); +
[08/10] camel git commit: CAMEL-11641: SupervisingRouteController : backOff should be renamed deaultBackoff
CAMEL-11641: SupervisingRouteController : backOff should be renamed deaultBackoff Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b3ebc7b2 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b3ebc7b2 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b3ebc7b2 Branch: refs/heads/master Commit: b3ebc7b2b730ca391bc669fad491f2d20625b5db Parents: a25eb77 Author: lburgazzoliAuthored: Mon Aug 7 09:21:24 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:28 2017 +0200 -- .../src/main/java/org/apache/camel/util/backoff/BackOff.java | 4 .../boot/SupervisingRouteControllerAutoConfiguration.java | 4 ++-- .../spring/boot/SupervisingRouteControllerConfiguration.java | 6 +++--- .../src/main/resources/application.properties | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/b3ebc7b2/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java -- diff --git a/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java b/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java index f38c957..85eb5ac 100644 --- a/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java +++ b/camel-core/src/main/java/org/apache/camel/util/backoff/BackOff.java @@ -133,6 +133,10 @@ public final class BackOff { return new Builder(); } +public static Builder builder(BackOff template) { +return new Builder().read(template); +} + /** * A builder for {@link BackOff} */ http://git-wip-us.apache.org/repos/asf/camel/blob/b3ebc7b2/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java index 7382c6f..abb747d 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerAutoConfiguration.java @@ -49,7 +49,7 @@ public class SupervisingRouteControllerAutoConfiguration { public RouteController routeController() { SupervisingRouteController controller = new SupervisingRouteController(); -controller.setDefaultBackOff(configureBackOff(Optional.empty(), configuration.getBackOff())); +controller.setDefaultBackOff(configureBackOff(Optional.empty(), configuration.getDefaultBackOff())); for (Map.Entry entry: configuration.getRoutes().entrySet()) { controller.setBackOff( @@ -65,7 +65,7 @@ public class SupervisingRouteControllerAutoConfiguration { } private BackOff configureBackOff(Optional template, BackOffConfiguration conf) { -final BackOff.Builder builder = template.map(t -> BackOff.builder().read(t)).orElseGet(BackOff::builder); +final BackOff.Builder builder = template.map(BackOff::builder).orElseGet(BackOff::builder); Optional.ofNullable(conf.getDelay()).map(TimePatternConverter::toMilliSeconds).ifPresent(builder::delay); Optional.ofNullable(conf.getMaxDelay()).map(TimePatternConverter::toMilliSeconds).ifPresent(builder::maxDelay); http://git-wip-us.apache.org/repos/asf/camel/blob/b3ebc7b2/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java index bf68b6a..fb667b3 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java @@ -31,7 +31,7 @@ public class SupervisingRouteControllerConfiguration { /** * The default back-off configuration, back-off configuration for routes inherits from this default. */ -private BackOffConfiguration backOff = new BackOffConfiguration(); +private BackOffConfiguration defaultBackOff = new
[02/10] camel git commit: CAMEL-11584: Add javadoc to spring boot auto configuration of camel.supervising.controller
CAMEL-11584: Add javadoc to spring boot auto configuration of camel.supervising.controller Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/29a3b28b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/29a3b28b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/29a3b28b Branch: refs/heads/master Commit: 29a3b28b0c7b4a3caeb78c14d75d5f0393aa191b Parents: b354cba Author: lburgazzoliAuthored: Mon Aug 7 08:15:10 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:27 2017 +0200 -- ...SupervisingRouteControllerConfiguration.java | 42 1 file changed, 42 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/29a3b28b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java -- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java index 01c2d0e..32ef447 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/SupervisingRouteControllerConfiguration.java @@ -23,8 +23,19 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "camel.supervising.controller") public class SupervisingRouteControllerConfiguration { +/** + * Global option to enable/disable this ${@link org.apache.camel.spi.RouteController}, default is false. + */ private boolean enabled; + +/** + * The default back-off configuration, back-off configuration for routes inherits from this default. + */ private BackOffConfiguration backOff = new BackOffConfiguration(); + +/** + * Routes configuration. + */ private Map routes = new HashMap<>(); public boolean isEnabled() { @@ -48,6 +59,9 @@ public class SupervisingRouteControllerConfiguration { // * public static class RouteConfiguration { +/** + * The back-off configuration from this route, inherits from default back-off + */ private BackOffConfiguration backOff; public BackOffConfiguration getBackOff() { @@ -60,10 +74,38 @@ public class SupervisingRouteControllerConfiguration { } public static class BackOffConfiguration { +/** + * The delay to wait before retry the operation. + * + * You can also specify time values using units, such as 60s (60 seconds), + * 5m30s (5 minutes and 30 seconds), and 1h (1 hour). + */ private String delay; + +/** + * The maximum back-off time. + * + * You can also specify time values using units, such as 60s (60 seconds), + * 5m30s (5 minutes and 30 seconds), and 1h (1 hour). + */ private String maxDelay; + +/** + * The maximum elapsed time after which the back-off is exhausted. + * + * You can also specify time values using units, such as 60s (60 seconds), + * 5m30s (5 minutes and 30 seconds), and 1h (1 hour). + */ private String maxElapsedTime; + +/** + * Teh maximum number of attempts after which the back-off is exhausted. + */ private Long maxAttempts; + +/** + * The value to multiply the current interval by for each retry attempt. + */ private Double multiplier; public String getDelay() {
[01/10] camel git commit: CAMEL-11588: SupervisingRouteController - Routes may be started in wrong order
Repository: camel Updated Branches: refs/heads/master d901b59e8 -> 43ca13886 CAMEL-11588: SupervisingRouteController - Routes may be started in wrong order Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0be3d902 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0be3d902 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0be3d902 Branch: refs/heads/master Commit: 0be3d9025dbbc3095e2553190e6740816bed1fdb Parents: d901b59 Author: lburgazzoliAuthored: Fri Aug 4 16:43:15 2017 +0200 Committer: lburgazzoli Committed: Tue Aug 8 13:29:24 2017 +0200 -- .../camel/impl/SupervisingRouteController.java | 299 --- 1 file changed, 187 insertions(+), 112 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/0be3d902/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java -- diff --git a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java index 1f92653..aaa6796 100644 --- a/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java +++ b/camel-core/src/main/java/org/apache/camel/impl/SupervisingRouteController.java @@ -17,7 +17,6 @@ package org.apache.camel.impl; import java.util.Collection; -import java.util.Comparator; import java.util.EventObject; import java.util.HashMap; import java.util.List; @@ -31,20 +30,25 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.Experimental; import org.apache.camel.Route; +import org.apache.camel.RuntimeCamelException; import org.apache.camel.ServiceStatus; import org.apache.camel.StartupListener; import org.apache.camel.management.event.CamelContextStartedEvent; import org.apache.camel.model.RouteDefinition; +import org.apache.camel.spi.HasId; +import org.apache.camel.spi.RouteContext; import org.apache.camel.spi.RouteController; import org.apache.camel.spi.RoutePolicy; import org.apache.camel.spi.RoutePolicyFactory; import org.apache.camel.support.EventNotifierSupport; +import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.backoff.BackOff; import org.apache.camel.util.backoff.BackOffContext; import org.apache.camel.util.backoff.BackOffTimer; @@ -63,8 +67,8 @@ public class SupervisingRouteController extends DefaultRouteController { private static final Logger LOGGER = LoggerFactory.getLogger(SupervisingRouteController.class); private final Object lock; private final AtomicBoolean contextStarted; -private final Set startedRoutes; -private final Set stoppedRoutes; +private final AtomicInteger routeCount; +private final Set routes; private final CamelContextStartupListener listener; private final RouteManager routeManager; private BackOffTimer timer; @@ -73,14 +77,10 @@ public class SupervisingRouteController extends DefaultRouteController { private Map backOffConfigurations; public SupervisingRouteController() { -final Comparator comparator = Comparator.comparing( -route -> Optional.ofNullable(route.getRouteContext().getRoute().getStartupOrder()).orElse(Integer.MIN_VALUE) -); - this.lock = new Object(); this.contextStarted = new AtomicBoolean(false); -this.stoppedRoutes = new TreeSet<>(comparator); -this.startedRoutes = new TreeSet<>(comparator.reversed()); +this.routeCount = new AtomicInteger(0); +this.routes = new TreeSet<>(); this.routeManager = new RouteManager(); this.defaultBackOff = BackOff.builder().build(); this.backOffConfigurations = new HashMap<>(); @@ -160,96 +160,103 @@ public class SupervisingRouteController extends DefaultRouteController { @Override public void startRoute(String routeId) throws Exception { -final CamelContext context = getCamelContext(); -final Route route = context.getRoute(routeId); +final Optional route = routes.stream().filter(r -> r.getId().equals(routeId)).findFirst(); -if (route == null) { -return; +if (!route.isPresent()) { +// This route is unknown to this controller, apply default behaviour +// from super class. +super.startRoute(routeId); +} else { +
camel git commit: CAMEL-11649 - Cookie Handling only works for one cookie
Repository: camel Updated Branches: refs/heads/master 80a83842c -> d901b59e8 CAMEL-11649 - Cookie Handling only works for one cookie Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d901b59e Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d901b59e Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d901b59e Branch: refs/heads/master Commit: d901b59e8d5a77aad1b87e8effd12ff708ead135 Parents: 80a8384 Author: Stephan SianoAuthored: Tue Aug 8 12:42:59 2017 +0200 Committer: Stephan Siano Committed: Tue Aug 8 12:45:53 2017 +0200 -- .../camel/component/ahc/DefaultAhcBinding.java | 24 +++- .../component/ahc/AhcProducerSessionTest.java | 2 ++ 2 files changed, 15 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/d901b59e/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java -- diff --git a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java index dae132b..2e5c3d9 100644 --- a/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java +++ b/components/camel-ahc/src/main/java/org/apache/camel/component/ahc/DefaultAhcBinding.java @@ -25,12 +25,12 @@ import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.nio.charset.Charset; -import java.util.Collections; -import java.util.HashMap; import java.util.LinkedHashMap; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.TreeMap; import org.apache.camel.CamelExchangeException; import org.apache.camel.Exchange; @@ -128,11 +128,11 @@ public class DefaultAhcBinding implements AhcBinding { Map cookieHeaders = endpoint.getCookieHandler().loadCookies(exchange, uri); for (Map.Entry entry : cookieHeaders.entrySet()) { String key = entry.getKey(); -if (entry.getValue().size() > 0) { -// use the default toString of a ArrayList to create in the form [xxx, yyy] -// if multi valued, for a single value, then just output the value as is -String s = entry.getValue().size() > 1 ? entry.getValue().toString() : entry.getValue().get(0); -builder.addHeader(key, s); +for (String value : entry.getValue()) { +if (log.isTraceEnabled()) { +log.trace("Adding header {} = {}", key, value); +} +builder.addHeader(key, value); } } } catch (IOException e) { @@ -233,13 +233,15 @@ public class DefaultAhcBinding implements AhcBinding { @Override public void onHeadersReceived(AhcEndpoint endpoint, Exchange exchange, HttpResponseHeaders headers) throws Exception { -List > l = headers.getHeaders().entries(); -Map m = new HashMap (); +Map m = new TreeMap (String.CASE_INSENSITIVE_ORDER); for (Entry entry : headers.getHeaders().entries()) { String key = entry.getKey(); String value = entry.getValue(); -m.put(key, Collections.singletonList(value)); -exchange.getOut().getHeaders().put(key, value); +if (!m.containsKey(key)) { +m.put(key, new LinkedList()); +exchange.getOut().getHeaders().put(key, value); +} +m.get(key).add(value); } // handle cookies if (endpoint.getCookieHandler() != null) { http://git-wip-us.apache.org/repos/asf/camel/blob/d901b59e/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java -- diff --git a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java index ca9bebe..95b519a 100644 --- a/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java +++ b/components/camel-ahc/src/test/java/org/apache/camel/component/ahc/AhcProducerSessionTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.ahc; +import
camel git commit: Remove camel-jackson-starter with scope test from Camel-spring-boot component and use the pure camel-jackson component
Repository: camel Updated Branches: refs/heads/master 206b6e33a -> 80a83842c Remove camel-jackson-starter with scope test from Camel-spring-boot component and use the pure camel-jackson component Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/80a83842 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/80a83842 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/80a83842 Branch: refs/heads/master Commit: 80a83842c2fb6821e780a931770bcce3d7cd5d98 Parents: 206b6e3 Author: Andrea CosentinoAuthored: Tue Aug 8 09:39:28 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 09:39:28 2017 +0200 -- components/camel-spring-boot/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/80a83842/components/camel-spring-boot/pom.xml -- diff --git a/components/camel-spring-boot/pom.xml b/components/camel-spring-boot/pom.xml index 7393705..1b814e6 100644 --- a/components/camel-spring-boot/pom.xml +++ b/components/camel-spring-boot/pom.xml @@ -110,7 +110,7 @@ org.apache.camel - camel-jackson-starter + camel-jackson test
camel git commit: CAMEL-11644 - Changed parent artifactId
Repository: camel Updated Branches: refs/heads/master 5d7638206 -> 206b6e33a CAMEL-11644 - Changed parent artifactId Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/206b6e33 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/206b6e33 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/206b6e33 Branch: refs/heads/master Commit: 206b6e33ae36db26aeb987608e1ea0b3c778056a Parents: 5d76382 Author: Andrea CosentinoAuthored: Tue Aug 8 09:19:43 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 09:19:43 2017 +0200 -- .../hello-camel-grpc-client/pom.xml | 10 +- .../hello-camel-grpc-server/pom.xml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/206b6e33/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml -- diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml index 555e589..92363dd 100644 --- a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml +++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/pom.xml @@ -21,11 +21,11 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> 4.0.0 - -org.apache.camel.example -examples -2.20.0-SNAPSHOT - + +org.apache.camel.example +camel-example-spring-boot-grpc +2.20.0-SNAPSHOT + camel-example-hello-grpc-client Camel :: Example :: gRPC :: Hello Camel Client http://git-wip-us.apache.org/repos/asf/camel/blob/206b6e33/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml -- diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml index 646755c..66b1d2f 100644 --- a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml +++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.apache.camel.example - camel-example-zipkin + camel-example-spring-boot-grpc 2.20.0-SNAPSHOT
camel git commit: Upgrade Kubernetes client to version 2.6.1
Repository: camel Updated Branches: refs/heads/master 1c79aefdd -> 5d7638206 Upgrade Kubernetes client to version 2.6.1 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d763820 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d763820 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d763820 Branch: refs/heads/master Commit: 5d76382060f2474802754c310cc9526e4ca6b29c Parents: 1c79aefd Author: Andrea CosentinoAuthored: Tue Aug 8 09:02:15 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 09:02:15 2017 +0200 -- parent/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5d763820/parent/pom.xml -- diff --git a/parent/pom.xml b/parent/pom.xml index b9c1416..8030a2a 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -431,7 +431,7 @@ 4.1.1 6.5.0.Final 0.4.9 -2.5.9 +2.6.1 1.1.2 2.3.0_3 1.8
[3/3] camel git commit: CAMEL-11644 - Fixed CS
CAMEL-11644 - Fixed CS Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1c79aefd Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1c79aefd Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1c79aefd Branch: refs/heads/master Commit: 1c79aefddac9c5d469247ed9559ef59283e0cb86 Parents: 5cc09fa Author: Andrea CosentinoAuthored: Tue Aug 8 08:32:50 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 08:32:58 2017 +0200 -- .../apache/camel/examples/grpc/HelloCamelServer.java| 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/1c79aefd/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java -- diff --git a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java index 21ef8bf..68b851a 100644 --- a/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java +++ b/examples/camel-example-spring-boot-grpc/hello-camel-grpc-server/src/main/java/org/apache/camel/examples/grpc/HelloCamelServer.java @@ -19,19 +19,19 @@ package org.apache.camel.examples.grpc; import java.io.IOException; import java.util.logging.Logger; -import org.apache.camel.examples.CamelHelloGrpc; -import org.apache.camel.examples.CamelHelloReply; -import org.apache.camel.examples.CamelHelloRequest; - import io.grpc.Server; import io.grpc.ServerBuilder; import io.grpc.stub.StreamObserver; +import org.apache.camel.examples.CamelHelloGrpc; +import org.apache.camel.examples.CamelHelloReply; +import org.apache.camel.examples.CamelHelloRequest; + /** * Server that manages startup/shutdown of a server. */ public class HelloCamelServer { -private static final Logger logger = Logger.getLogger(HelloCamelServer.class.getName()); +private static final Logger LOG = Logger.getLogger(HelloCamelServer.class.getName()); private Server server; @@ -39,7 +39,7 @@ public class HelloCamelServer { /* The port on which the server should run */ int port = 50051; server = ServerBuilder.forPort(port).addService(new HelloCamelImpl()).build().start(); -logger.info("Server started. I'm listening on " + port); +LOG.info("Server started. I'm listening on " + port); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() {
[1/3] camel git commit: CAMEL-11644 - Create a Camel-gRPC example
Repository: camel Updated Branches: refs/heads/master 4dc3e7200 -> 1c79aefdd CAMEL-11644 - Create a Camel-gRPC example Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a7526e9b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7526e9b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7526e9b Branch: refs/heads/master Commit: a7526e9bdb5b9f1af33ffc141f820f2f051bc8b0 Parents: 4dc3e72 Author: Andrea CosentinoAuthored: Tue Aug 8 08:10:33 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 08:10:33 2017 +0200 -- .../camel-example-spring-boot-grpc/README.adoc | 66 ++ .../hello-camel-grpc-client/pom.xml | 126 +++ .../example/springboot/grpc/Application.java| 34 + .../example/springboot/grpc/CamelGrpcRoute.java | 45 +++ .../src/main/proto/hellocamel.proto | 39 ++ .../src/main/resources/application.properties | 19 +++ .../hello-camel-grpc-server/pom.xml | 88 + .../camel/examples/grpc/HelloCamelServer.java | 82 .../src/main/proto/hellocamel.proto | 39 ++ examples/camel-example-spring-boot-grpc/pom.xml | 45 +++ 10 files changed, 583 insertions(+) -- http://git-wip-us.apache.org/repos/asf/camel/blob/a7526e9b/examples/camel-example-spring-boot-grpc/README.adoc -- diff --git a/examples/camel-example-spring-boot-grpc/README.adoc b/examples/camel-example-spring-boot-grpc/README.adoc new file mode 100644 index 000..637d5b4 --- /dev/null +++ b/examples/camel-example-spring-boot-grpc/README.adoc @@ -0,0 +1,66 @@ +# Spring Boot Example with gRPC + +### Introduction + +This example demonstrates how you can use Camel-gRPC Starter component. The example is composed of a standalone gRPC server and a Camel Spring-boot gRPC route acting as client. + +### Server + +You can build the server under the directory hello-camel-grpc-server with: + +$ mvn clean install + +and then run the server with + +$ mvn exec:java + +You should see the following output: + +[source,bash] + +Aug 08, 2017 8:00:00 AM org.apache.camel.examples.grpc.HelloCamelServer start +INFO: Server started. I'm listening on 50051 + + +### Run the client + +You can build the client example under the directory hello-camel-grpc-client with: + +$ mvn clean install + +and then run the example with + +$ mvn spring-boot:run + +And you should see this output in the console. + +[source,bash] + +2017-08-08 08:01:14.530 INFO 7096 --- [ main] o.a.c.e.springboot.grpc.Application : Starting Application on ghost with PID 7096 (/home/oscerd/workspace/apache-camel/camel/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client/target/classes started by oscerd in /home/oscerd/workspace/apache-camel/camel/examples/camel-example-spring-boot-grpc/hello-camel-grpc-client) +2017-08-08 08:01:14.532 INFO 7096 --- [ main] o.a.c.e.springboot.grpc.Application : No active profile set, falling back to default profiles: default +2017-08-08 08:01:14.563 INFO 7096 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@540ff973: startup date [Tue Aug 08 08:01:14 CEST 2017]; root of context hierarchy +2017-08-08 08:01:15.177 INFO 7096 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$78492c0f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) +2017-08-08 08:01:15.447 INFO 7096 --- [ main] o.a.c.i.converter.DefaultTypeConverter : Type converters loaded (core: 192, classpath: 1) +2017-08-08 08:01:15.844 INFO 7096 --- [ main] o.s.j.e.a.AnnotationMBeanExporter: Registering beans for JMX exposure on startup +2017-08-08 08:01:15.894 INFO 7096 --- [ main] o.a.camel.spring.boot.RoutesCollector: Loading additional Camel XML routes from: classpath:camel/*.xml +2017-08-08 08:01:15.894 INFO 7096 --- [ main] o.a.camel.spring.boot.RoutesCollector: Loading additional Camel XML rests from: classpath:camel-rest/*.xml +2017-08-08 08:01:15.895 INFO 7096 --- [ main] o.a.camel.spring.boot.RoutesCollector: Starting CamelMainRunController to ensure the main thread keeps running +2017-08-08 08:01:15.898 INFO 7096 --- [inRunController] o.a.camel.spring.SpringCamelContext : Apache Camel 2.20.0-SNAPSHOT (CamelContext: gRPC) is starting +2017-08-08
[2/3] camel git commit: CAMEL-11644 - Regen readme
CAMEL-11644 - Regen readme Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5cc09faa Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5cc09faa Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5cc09faa Branch: refs/heads/master Commit: 5cc09faa1751a29f021e4370b07b0aafda4cfb41 Parents: a7526e9 Author: Andrea CosentinoAuthored: Tue Aug 8 08:28:34 2017 +0200 Committer: Andrea Cosentino Committed: Tue Aug 8 08:28:34 2017 +0200 -- examples/README.adoc | 4 +++- examples/pom.xml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/camel/blob/5cc09faa/examples/README.adoc -- diff --git a/examples/README.adoc b/examples/README.adoc index f302ed3..bb2568c 100644 --- a/examples/README.adoc +++ b/examples/README.adoc @@ -11,7 +11,7 @@ View the individual example READMEs for details. ### Examples // examples: START -Number of Examples: 95 (8 deprecated) +Number of Examples: 96 (8 deprecated) [width="100%",cols="4,2,4",options="header"] |=== @@ -68,6 +68,8 @@ Number of Examples: 95 (8 deprecated) | link:camel-example-hazelcast-kubernetes/ReadMe.md[Hazelcast Kubernetes] (camel-example-hazelcast-kubernetes) | Cloud | An example with Camel and Hazelcast running on Kubernetes +| link:camel-example-spring-boot-grpc/README.adoc[Spring Boot Grpc] (camel-example-spring-boot-grpc) | Cloud | An example showing the Camel gRPC component with Spring Boot + | link:camel-example-spring-boot-infinispan/README.adoc[Spring Boot Infinispan] (camel-example-spring-boot-infinispan) | Cloud | An example showing the Camel Infinispan component with Spring Boot | link:camel-example-spring-boot-servicecall/README.adoc[Spring Boot Servicecall] (camel-example-spring-boot-servicecall) | Cloud | An example showing how to work with Camel ServiceCall EIP and Spring Boot http://git-wip-us.apache.org/repos/asf/camel/blob/5cc09faa/examples/pom.xml -- diff --git a/examples/pom.xml b/examples/pom.xml index aa99f0e..268733d 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -97,6 +97,7 @@ camel-example-spring-boot camel-example-spring-boot-activemq camel-example-spring-boot-geocoder +camel-example-spring-boot-grpc camel-example-spring-boot-infinispan camel-example-spring-boot-live-reload camel-example-spring-boot-metrics