Search in sources :

Example 1 with GroupFactory

use of io.fabric8.groups.GroupFactory in project fabric8 by jboss-fuse.

the class FabricDiscovery method addingService.

@Override
public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
    CuratorFramework curator = context.getService(reference);
    try {
        logger.debug("CuratorFramework found, starting group");
        GroupFactory factory = new ZooKeeperGroupFactory(curator);
        singleton = factory.createGroup("/fabric/registry/clusters/elasticsearch/" + clusterName.value(), ESNode.class);
        singleton.add(this);
        singleton.update(new ESNode(clusterName.value(), localNode, false));
        singleton.start();
    } catch (Exception e) {
        LOG.error("Error starting group", e);
    }
    return curator;
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) GroupFactory(io.fabric8.groups.GroupFactory) ZooKeeperGroupFactory(io.fabric8.groups.internal.ZooKeeperGroupFactory) ZooKeeperGroupFactory(io.fabric8.groups.internal.ZooKeeperGroupFactory) ElasticsearchException(org.elasticsearch.ElasticsearchException) ElasticsearchIllegalStateException(org.elasticsearch.ElasticsearchIllegalStateException) IOException(java.io.IOException)

Aggregations

GroupFactory (io.fabric8.groups.GroupFactory)1 ZooKeeperGroupFactory (io.fabric8.groups.internal.ZooKeeperGroupFactory)1 IOException (java.io.IOException)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1 ElasticsearchException (org.elasticsearch.ElasticsearchException)1 ElasticsearchIllegalStateException (org.elasticsearch.ElasticsearchIllegalStateException)1