camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Wang (JIRA)" <>
Subject [jira] [Commented] (CAMEL-8208) ZooKeeperRoutePolicy is not able to recover after session expiration
Date Wed, 07 Jan 2015 07:46:35 GMT


Leo Wang commented on CAMEL-8208:

I don't think this patch work for us because the internal ElectoralMonitorRoute is "dead"
once session expired which means that It won't receive any Exchange message afterward. So
you patched code was just not being reached.

Actually, we've done a fix by watching the Zookeeper client if SessionExpired event received,
we reset the ZooKeeperElection so that it create a new ElectoralMonitorRoute and do election
again next time when isMaster() is call.

    private ElectoralMonitorRoute electoralMonitorRoute;
    private ZooKeeperEndpoint createCandidateNode(CamelContext camelContext) {"Initializing ZookeeperElection with uri '{}'", uri);
        ZooKeeperEndpoint zep = camelContext.getEndpoint(uri, ZooKeeperEndpoint.class);
        String fullpath = createFullPathToCandidate(zep);
        Exchange e = zep.createExchange();
        e.getIn().setHeader(ZooKeeperMessage.ZOOKEEPER_NODE, fullpath);
        e.getIn().setHeader(ZooKeeperMessage.ZOOKEEPER_CREATE_MODE, CreateMode.EPHEMERAL_SEQUENTIAL);
        producerTemplate.send(zep, e);

        if (e.isFailed()) {
            LOG.error("Error setting up election node " + fullpath, e.getException());
        } else {
  "Candidate node '{}' has been created", fullpath);
            try {
                electoralMonitorRoute = new ElectoralMonitorRoute(zep);
            } catch (Exception ex) {
                LOG.error("Error configuring ZookeeperElection", ex);
        return zep;

    public void reset() throws Exception {
        this.isCandidateCreated = false;
        this.electionComplete = new CountDownLatch(1);
        producerTemplate = camelContext.createProducerTemplate();

> ZooKeeperRoutePolicy is not able to recover after session expiration
> --------------------------------------------------------------------
>                 Key: CAMEL-8208
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-zookeeper
>    Affects Versions: 2.13.2
>            Reporter: Leo Wang
> My company is using ZooKeeperRoutePolicy to maintain a Master/Slaver cluster. Sometimes
the cluster got network problem which make the app server disconnect from remote ZooKeeper
server. The disconnection usually don't last long but still long enough to expire the zookeeper
session of ZooKeeperRoutePolicy. By our observation, it seems ZooKeeperRoutePolicy would not
recovery and do re-election after session expiration which lead to multiple master situation.
> Is it possible to do enhancement or bug fixing on this?

This message was sent by Atlassian JIRA

View raw message