use of org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework in project metron by apache.
the class ParserTopologyBuilder method getSensorParserConfig.
/**
* Fetch the parser configuration from Zookeeper.
*
* @param zookeeperUrl Zookeeper URL
* @param sensorType Type of sensor
* @param configs
* @return
* @throws Exception
*/
private static SensorParserConfig getSensorParserConfig(String zookeeperUrl, String sensorType, ParserConfigurations configs) throws Exception {
try (CuratorFramework client = ConfigurationsUtils.getClient(zookeeperUrl)) {
client.start();
ConfigurationsUtils.updateParserConfigsFromZookeeper(configs, client);
SensorParserConfig parserConfig = configs.getSensorParserConfig(sensorType);
if (parserConfig == null) {
throw new IllegalStateException("Cannot find the parser configuration in zookeeper for " + sensorType + "." + " Please check that it exists in zookeeper by using the 'zk_load_configs.sh -m DUMP' command.");
}
return parserConfig;
}
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework in project pravega by pravega.
the class ZkStoreRetentionTest method testOwnershipOfExistingBucket.
@Test(timeout = 10000)
public void testOwnershipOfExistingBucket() throws Exception {
TestingServer zkServer2 = new TestingServerStarter().start();
zkServer2.start();
CuratorFramework zkClient2 = CuratorFrameworkFactory.newClient(zkServer2.getConnectString(), 10000, 1000, (r, e, s) -> false);
zkClient2.start();
ScheduledExecutorService executor2 = Executors.newScheduledThreadPool(10);
String hostId = UUID.randomUUID().toString();
StreamMetadataStore streamMetadataStore2 = StreamStoreFactory.createZKStore(zkClient2, 1, executor2);
TaskMetadataStore taskMetadataStore = TaskStoreFactory.createInMemoryStore(executor2);
HostControllerStore hostStore = HostStoreFactory.createInMemoryStore(HostMonitorConfigImpl.dummyConfig());
SegmentHelper segmentHelper = SegmentHelperMock.getSegmentHelperMock();
ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
StreamMetadataTasks streamMetadataTasks2 = new StreamMetadataTasks(streamMetadataStore2, hostStore, taskMetadataStore, segmentHelper, executor2, hostId, connectionFactory, false, "");
String scope = "scope1";
String streamName = "stream1";
streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope, streamName, RetentionPolicy.builder().build(), null, executor2).join();
String scope2 = "scope2";
String streamName2 = "stream2";
streamMetadataStore2.addUpdateStreamForAutoStreamCut(scope2, streamName2, RetentionPolicy.builder().build(), null, executor2).join();
StreamCutService service2 = new StreamCutService(1, hostId, streamMetadataStore2, streamMetadataTasks2, executor2);
service2.startAsync();
service2.awaitRunning();
assertTrue(service2.getBuckets().stream().allMatch(x -> x.getRetentionFutureMap().size() == 2));
service2.stopAsync();
service2.awaitTerminated();
zkClient2.close();
zkServer2.close();
streamMetadataTasks2.close();
connectionFactory.close();
executor2.shutdown();
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework in project eventuate-local by eventuate-local.
the class EventTableChangesToAggregateTopicRelayConfiguration method makeStartedCuratorClient.
static CuratorFramework makeStartedCuratorClient(String connectionString) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
CuratorFramework client = CuratorFrameworkFactory.builder().retryPolicy(retryPolicy).connectString(connectionString).build();
client.start();
return client;
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework in project eventuate-local by eventuate-local.
the class EventTableChangesToAggregateTopicTranslatorConfiguration method makeStartedCuratorClient.
static CuratorFramework makeStartedCuratorClient(String connectionString) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
CuratorFramework client = CuratorFrameworkFactory.builder().retryPolicy(retryPolicy).connectString(connectionString).build();
client.start();
return client;
}
use of org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework in project Saturn by vipshop.
the class InitSaturnJob method main.
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
String zkConnection = System.getProperty("VIP_SATURN_ZK_CONNECTION");
System.out.println("zkConnection=" + zkConnection);
if (zkConnection == null || "".equals(zkConnection.trim())) {
zkConnection = "localhost:2182";
}
CuratorFramework client = CuratorFrameworkFactory.builder().connectString(zkConnection).namespace("saturn-it.vip.com").sessionTimeoutMs(10000).retryPolicy(retryPolicy).build();
client.start();
addJavaJob(client, "demoJavaJob");
System.out.println("done add a java-job.");
addShellJob(client, "demoShellJob");
System.out.println("done add a shell-job.");
}
Aggregations