Repository: camel Updated Branches: refs/heads/master f8ca43d05 -> d409f337e
CAMEL-10289: Move RoutePolicy initialization logic in onStart Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d409f337 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d409f337 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d409f337 Branch: refs/heads/master Commit: d409f337eb6bda930c0d6663df99333538074162 Parents: f8ca43d Author: lburgazzoli <lburgazz...@gmail.com> Authored: Mon Sep 5 15:59:24 2016 +0200 Committer: lburgazzoli <lburgazz...@gmail.com> Committed: Mon Sep 5 15:59:24 2016 +0200 ---------------------------------------------------------------------- .../component/etcd/policy/EtcdRoutePolicy.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/d409f337/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/policy/EtcdRoutePolicy.java ---------------------------------------------------------------------- diff --git a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/policy/EtcdRoutePolicy.java b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/policy/EtcdRoutePolicy.java index 115af13..57a582d 100644 --- a/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/policy/EtcdRoutePolicy.java +++ b/components/camel-etcd/src/main/java/org/apache/camel/component/etcd/policy/EtcdRoutePolicy.java @@ -28,7 +28,6 @@ import mousio.etcd4j.EtcdClient; import mousio.etcd4j.responses.EtcdErrorCode; import mousio.etcd4j.responses.EtcdException; import mousio.etcd4j.responses.EtcdKeysResponse; -import org.apache.camel.Exchange; import org.apache.camel.NonManagedService; import org.apache.camel.Route; import org.apache.camel.RuntimeCamelException; @@ -77,19 +76,9 @@ public class EtcdRoutePolicy extends RoutePolicySupport implements ResponsePromi } @Override - public void onExchangeBegin(Route route, Exchange exchange) { - if (leader.get()) { - if (shouldStopConsumer) { - startConsumer(route); - } - } else { - if (shouldStopConsumer) { - stopConsumer(route); - } - - exchange.setException(new IllegalStateException( - "Etcd based route policy prohibits processing exchanges, stopping route and failing the exchange") - ); + public void onStart(Route route) { + if (!leader.get() && shouldStopConsumer) { + stopConsumer(route); } }