[
https://issues.apache.org/jira/browse/CAMEL-7501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14525229#comment-14525229
]
Andrea Cosentino commented on CAMEL-7501:
-----------------------------------------
You're right, Nathan. Good catch! :-)
Test with the substring:
{code}
2015-05-02 13:58:23,478 [main ] INFO AvailablePortFinder
- getNextAvailable(39913) -> 39913
2015-05-02 13:58:23,478 [main ] INFO ZooKeeperTestSupport
- Starting Zookeeper Test Infrastructure
2015-05-02 13:58:23,606 [ain-EventThread] INFO estSupport$TestZookeeperClient
- TestClient connected
2015-05-02 13:58:23,606 [main ] INFO ZooKeeperTestSupport
- Started Zookeeper Test Infrastructure on port 39913
2015-05-02 13:58:23,608 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:58:23,608 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Testing:
routeDoublePoliciesAndTwoRoutes(org.apache.camel.component.zookeeper.policy.ZookeeperDoubleRoutePolicyTest)
2015-05-02 13:58:23,608 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:58:23,806 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is starting
2015-05-02 13:58:23,807 [main ] INFO DefaultManagementStrategy
- JMX is disabled
2015-05-02 13:58:23,863 [main ] INFO DefaultTypeConverter
- Loaded 183 type converters
2015-05-02 13:58:23,864 [main ] INFO DefaultCamelContext
- AllowUseOriginalMessage is enabled. If access to the original message is not
needed, then its recommended to turn this option off as it may improve
performance.
2015-05-02 13:58:23,864 [main ] INFO DefaultCamelContext
- StreamCaching is not in use. If using streams then its recommended to enable
stream caching. See more details at http://camel.apache.org/stream-caching.html
2015-05-02 13:58:23,864 [main ] INFO DefaultCamelContext
- Total 0 routes, of which 0 is started.
2015-05-02 13:58:23,869 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) started in 0.058 seconds
2015-05-02 13:58:24,084 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp'
2015-05-02 13:58:24,288 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp/somepolicy'
2015-05-02 13:58:24,492 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp/someotherpolicy'
2015-05-02 13:58:24,632 [main ] INFO DefaultCamelContext
- Route: route1 started and consuming from: Endpoint[direct://policy-controlled]
2015-05-02 13:58:24,635 [main ] INFO DefaultCamelContext
- Route: route2 started and consuming from:
Endpoint[direct://policy-controlled-1]
2015-05-02 13:58:24,651 [main ] INFO ZooKeeperElection
- Initializing ZookeeperElection with uri
'zookeeper:localhost:39913/someapp/somepolicy'
2015-05-02 13:58:24,669 [main ] WARN ZookeeperProducer
- Node '/someapp/somepolicy/ancosen-home-73fdb664-2361-4fbd-9c06-74958c140c5c'
did not exist, creating it.
2015-05-02 13:58:24,677 [main ] INFO ZooKeeperElection
- Candidate node
'/someapp/somepolicy/ancosen-home-73fdb664-2361-4fbd-9c06-74958c140c5c' has
been created
2015-05-02 13:58:24,700 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,707 [main ] INFO MockEndpoint
- Asserting: Endpoint[mock://controlled] is satisfied
2015-05-02 13:58:24,708 [main ] INFO ZooKeeperElection
- Initializing ZookeeperElection with uri
'zookeeper:localhost:39913/someapp/someotherpolicy'
2015-05-02 13:58:24,714 [main ] WARN ZookeeperProducer
- Node
'/someapp/someotherpolicy/ancosen-home-e61215bc-dc9e-4773-8040-8af82bea10e3'
did not exist, creating it.
2015-05-02 13:58:24,717 [main ] INFO ZooKeeperElection
- Candidate node
'/someapp/someotherpolicy/ancosen-home-e61215bc-dc9e-4773-8040-8af82bea10e3'
has been created
2015-05-02 13:58:24,718 [main ] INFO DefaultShutdownStrategy
- Starting to graceful shutdown 1 routes (timeout 10 seconds)
2015-05-02 13:58:24,723 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: election-route-ancosen- shutdown complete, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,723 [main ] INFO DefaultShutdownStrategy
- Graceful shutdown of 1 routes completed in 0 seconds
2015-05-02 13:58:24,724 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- is stopped, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,730 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- is shutdown and removed, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,734 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
2015-05-02 13:58:24,736 [main ] INFO MockEndpoint
- Asserting: Endpoint[mock://controlled-1] is satisfied
2015-05-02 13:58:24,736 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:58:24,736 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Testing done:
routeDoublePoliciesAndTwoRoutes(org.apache.camel.component.zookeeper.policy.ZookeeperDoubleRoutePolicyTest)
2015-05-02 13:58:24,736 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Took: 0.867 seconds (867 millis)
2015-05-02 13:58:24,736 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:58:24,737 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is shutting down
2015-05-02 13:58:24,737 [main ] INFO DefaultShutdownStrategy
- Starting to graceful shutdown 3 routes (timeout 10 seconds)
2015-05-02 13:58:24,738 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: election-route-ancosen- shutdown complete, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
2015-05-02 13:58:24,738 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: route2 shutdown complete, was consuming from:
Endpoint[direct://policy-controlled-1]
2015-05-02 13:58:24,738 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: route1 shutdown complete, was consuming from:
Endpoint[direct://policy-controlled]
2015-05-02 13:58:24,738 [main ] INFO DefaultShutdownStrategy
- Graceful shutdown of 3 routes completed in 0 seconds
2015-05-02 13:58:24,743 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) uptime 0.937 seconds
2015-05-02 13:58:24,743 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is shutdown in 0.006
seconds
2015-05-02 13:58:24,744 [main ] INFO ZooKeeperTestSupport
- Stopping Zookeeper Test Infrastructure
2015-05-02 13:58:24,747 [main ] INFO ZooKeeperTestSupport
- Stopped Zookeeper Test Infrastructure
{code}
Only one election route started, shutdown of this route and start of the other
election route with the same id.
{code}
2015-05-02 13:58:24,700 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
.
.
.
2015-05-02 13:58:24,718 [main ] INFO DefaultShutdownStrategy
- Starting to graceful shutdown 1 routes (timeout 10 seconds)
2015-05-02 13:58:24,723 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: election-route-ancosen- shutdown complete, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,723 [main ] INFO DefaultShutdownStrategy
- Graceful shutdown of 1 routes completed in 0 seconds
2015-05-02 13:58:24,724 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- is stopped, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:58:24,734 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen- started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
{code}
Test without substring:
{code}
2015-05-02 13:59:42,606 [main ] INFO AvailablePortFinder
- getNextAvailable(39913) -> 39913
2015-05-02 13:59:42,607 [main ] INFO ZooKeeperTestSupport
- Starting Zookeeper Test Infrastructure
2015-05-02 13:59:42,735 [ain-EventThread] INFO estSupport$TestZookeeperClient
- TestClient connected
2015-05-02 13:59:42,735 [main ] INFO ZooKeeperTestSupport
- Started Zookeeper Test Infrastructure on port 39913
2015-05-02 13:59:42,738 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:59:42,738 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Testing:
routeDoublePoliciesAndTwoRoutes(org.apache.camel.component.zookeeper.policy.ZookeeperDoubleRoutePolicyTest)
2015-05-02 13:59:42,738 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:59:42,962 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is starting
2015-05-02 13:59:42,962 [main ] INFO DefaultManagementStrategy
- JMX is disabled
2015-05-02 13:59:43,028 [main ] INFO DefaultTypeConverter
- Loaded 183 type converters
2015-05-02 13:59:43,029 [main ] INFO DefaultCamelContext
- AllowUseOriginalMessage is enabled. If access to the original message is not
needed, then its recommended to turn this option off as it may improve
performance.
2015-05-02 13:59:43,029 [main ] INFO DefaultCamelContext
- StreamCaching is not in use. If using streams then its recommended to enable
stream caching. See more details at http://camel.apache.org/stream-caching.html
2015-05-02 13:59:43,030 [main ] INFO DefaultCamelContext
- Total 0 routes, of which 0 is started.
2015-05-02 13:59:43,034 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) started in 0.069 seconds
2015-05-02 13:59:43,248 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp'
2015-05-02 13:59:43,454 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp/somepolicy'
2015-05-02 13:59:43,659 [main ] INFO estSupport$TestZookeeperClient
- Created znode named '/someapp/someotherpolicy'
2015-05-02 13:59:43,795 [main ] INFO DefaultCamelContext
- Route: route1 started and consuming from: Endpoint[direct://policy-controlled]
2015-05-02 13:59:43,797 [main ] INFO DefaultCamelContext
- Route: route2 started and consuming from:
Endpoint[direct://policy-controlled-1]
2015-05-02 13:59:43,813 [main ] INFO ZooKeeperElection
- Initializing ZookeeperElection with uri
'zookeeper:localhost:39913/someapp/somepolicy'
2015-05-02 13:59:43,832 [main ] WARN ZookeeperProducer
- Node '/someapp/somepolicy/ancosen-home-74bce950-9db9-4d75-b070-cd5fefcaba42'
did not exist, creating it.
2015-05-02 13:59:43,838 [main ] INFO ZooKeeperElection
- Candidate node
'/someapp/somepolicy/ancosen-home-74bce950-9db9-4d75-b070-cd5fefcaba42' has
been created
2015-05-02 13:59:43,860 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen-home-74bce950-9db9-4d75-b070-cd5fefcaba42
started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:59:43,866 [main ] INFO MockEndpoint
- Asserting: Endpoint[mock://controlled] is satisfied
2015-05-02 13:59:43,867 [main ] INFO ZooKeeperElection
- Initializing ZookeeperElection with uri
'zookeeper:localhost:39913/someapp/someotherpolicy'
2015-05-02 13:59:43,873 [main ] WARN ZookeeperProducer
- Node
'/someapp/someotherpolicy/ancosen-home-e00213ec-cf67-4a80-ac11-8b0d8b7785fe'
did not exist, creating it.
2015-05-02 13:59:43,876 [main ] INFO ZooKeeperElection
- Candidate node
'/someapp/someotherpolicy/ancosen-home-e00213ec-cf67-4a80-ac11-8b0d8b7785fe'
has been created
2015-05-02 13:59:43,880 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen-home-e00213ec-cf67-4a80-ac11-8b0d8b7785fe
started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
2015-05-02 13:59:43,881 [main ] INFO MockEndpoint
- Asserting: Endpoint[mock://controlled-1] is satisfied
2015-05-02 13:59:43,881 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:59:43,881 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Testing done:
routeDoublePoliciesAndTwoRoutes(org.apache.camel.component.zookeeper.policy.ZookeeperDoubleRoutePolicyTest)
2015-05-02 13:59:43,881 [main ] INFO ZookeeperDoubleRoutePolicyTest
- Took: 0.847 seconds (847 millis)
2015-05-02 13:59:43,881 [main ] INFO ZookeeperDoubleRoutePolicyTest
-
********************************************************************************
2015-05-02 13:59:43,882 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is shutting down
2015-05-02 13:59:43,882 [main ] INFO DefaultShutdownStrategy
- Starting to graceful shutdown 4 routes (timeout 10 seconds)
2015-05-02 13:59:43,886 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: election-route-ancosen-home-e00213ec-cf67-4a80-ac11-8b0d8b7785fe
shutdown complete, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
2015-05-02 13:59:43,887 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: election-route-ancosen-home-74bce950-9db9-4d75-b070-cd5fefcaba42
shutdown complete, was consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
2015-05-02 13:59:43,888 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: route2 shutdown complete, was consuming from:
Endpoint[direct://policy-controlled-1]
2015-05-02 13:59:43,888 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: route1 shutdown complete, was consuming from:
Endpoint[direct://policy-controlled]
2015-05-02 13:59:43,888 [main ] INFO DefaultShutdownStrategy
- Graceful shutdown of 4 routes completed in 0 seconds
2015-05-02 13:59:43,897 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) uptime 0.936 seconds
2015-05-02 13:59:43,897 [main ] INFO DefaultCamelContext
- Apache Camel 2.16-SNAPSHOT (CamelContext: camel-1) is shutdown in 0.015
seconds
2015-05-02 13:59:43,898 [main ] INFO ZooKeeperTestSupport
- Stopping Zookeeper Test Infrastructure
2015-05-02 13:59:43,902 [main ] INFO ZooKeeperTestSupport
- Stopped Zookeeper Test Infrastructure
{code}
Two distinct election routes started:
{code}
2015-05-02 13:59:43,860 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen-home-74bce950-9db9-4d75-b070-cd5fefcaba42
started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/somepolicy]
.
.
.
2015-05-02 13:59:43,880 [main ] INFO DefaultCamelContext
- Route: election-route-ancosen-home-e00213ec-cf67-4a80-ac11-8b0d8b7785fe
started and consuming from:
Endpoint[zookeeper://localhost:39913/someapp/someotherpolicy]
{code}
> Only one ZooKeeperRoutePolicy possible
> --------------------------------------
>
> Key: CAMEL-7501
> URL: https://issues.apache.org/jira/browse/CAMEL-7501
> Project: Camel
> Issue Type: Improvement
> Components: camel-zookeeper
> Affects Versions: 2.12.3
> Reporter: Scott Stults
> Assignee: Andrea Cosentino
> Fix For: Future
>
>
> If two ZooKeeperRoutePolicy's are created and used in separate routes, only
> one leader election route gets created. This effectively nullifies the route
> policy for the second route, meaning it works regardless of leadership status
> (even on the other route).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)