camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Baltej Singh <bsi...@ra.rockwell.com>
Subject Camel-ZooKeeperRoutePolicy clarification - Slave Camel does not start after Master Camel shutdown
Date Fri, 18 Nov 2016 23:34:00 GMT
Hello,

I a simple application to test my first zookeeper/camel cluster.
When I Kill the Master Camel server, I expect Slave to start route, but Slave route never
starts.
What is missing in the java code?

Thanks,
Baltej

Java code - Started with Camel in Action 2 sample quartz route

public class QuartzCronWithPolicy {

       public static void main(String args[]) throws Exception {

             CamelContext context = new DefaultCamelContext();
             ZooKeeperComponent zookeeperComponent = new ZooKeeperComponent();
             ZooKeeperConfiguration zooConfig = new ZooKeeperConfiguration();
        zooConfig.addZookeeperServer("localhost:2182");
        zooConfig.addZookeeperServer("localhost:2183");
        zookeeperComponent.setConfiguration(zooConfig);

             context.addRoutes(new RouteBuilder() {
             public void configure() {
                    ZooKeeperRoutePolicy zooKeeperRoutePolicy = new ZooKeeperRoutePolicy("zookeeper://localhost:2181/ELECTION",
1);

            from("quartz2://report?cron=0/2+*+*+*+*+?")
            .routePolicy(zooKeeperRoutePolicy)
            .setBody().simple("I was fired at ${header.fireTime}")
            .to("stream:out")
            .to("mock:end");
             }
             });

             context.start();
       }
}
Followed docs at:
http://camel.apache.org/zookeeper.html
Camel setup, followed:
http://frommyworkshop.blogspot.com/2013/06/leader-election-of-camel-router-through.html
Zookeeper setup, followed:
http://myjeeva.com/zookeeper-cluster-setup.html



Steps

1.      Start Master and Slave in separate cmds

2.      Master Camel server starts properly and prints message.

I was fired at Fri Nov 18 15:18:28 PST 2016

I was fired at Fri Nov 18 15:18:30 PST 2016

I was fired at Fri Nov 18 15:18:32 PST 2016

...

3.      Slave Camel server is started but not processing route, as expected.

4.      Kill Master - expect Slave to start route, but Slave route never starts




Environment
Using Camel 2.17.3 and zookeeper-3.4.9
3 nodes in zookeeper cluster
2 Camel nodes  Master/Slave
Route prints a message every 2 seconds.





Zookeeper data tree
C:\tools\zookeeper\data>tree
Folder PATH listing for volume RAW7121218
Volume serial number is 0C09-AE01
C:.
├───zk1
│   └───version-2
├───zk2
│   └───version-2
├───zk3
│   └───version-2


Zookeeper Log
2016-11-18 10:56:08,196 [myid:1] - WARN  [QuorumPeer[myid=1]/0:0:0:0:0:0:0:0:2181:Follower@116]
- Got zxid 0x700000001 expected 0x1
2016-11-18 10:56:08,282 [myid:1] - INFO  [CommitProcessor:1:ZooKeeperServer@673] - Established
session 0x158787a0a7f0000 with negotiated timeout 5000
for client /0:0:0:0:0:0:0:1:2872
2016-11-18 10:56:08,287 [myid:1] - INFO  [CommitProcessor:1:ZooKeeperServer@673] - Established
session 0x158787a0a7f0001 with negotiated timeout 5000
for client /0:0:0:0:0:0:0:1:2873
2016-11-18 10:57:03,968 [myid:1] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@362]
- Exception causing close of session 0x158787a0
a7f0001 due to java.io.IOException: An existing connection was forcibly closed by the remote
host
2016-11-18 10:57:03,988 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008]
- Closed socket connection for client /0:0:0:0
:0:0:0:1:2873 which had sessionid 0x158787a0a7f0001
2016-11-18 10:58:33,251 [myid:1] - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@362]
- Exception causing close of session 0x158787a0
a7f0000 due to java.io.IOException: An existing connection was forcibly closed by the remote
host
2016-11-18 10:58:33,251 [myid:1] - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1008]
- Closed socket connection for client /0:0:0:0
:0:0:0:1:2872 which had sessionid 0x158787a0a7f0000

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message