- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.samza.zk.ZkLeaderElector.<init>()
方法的一些代码示例,展示了ZkLeaderElector.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkLeaderElector.<init>()
方法的具体详情如下:
包路径:org.apache.samza.zk.ZkLeaderElector
类名称:ZkLeaderElector
方法名:<init>
暂无
代码示例来源:origin: apache/samza
@Override
public LeaderElector getLeaderElector() {
return new ZkLeaderElector(processorIdStr, zkUtils);
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
@Override
public LeaderElector getLeaderElector() {
return new ZkLeaderElector(processorIdStr, zkUtils);
}
代码示例来源:origin: org.apache.samza/samza-core
@Override
public LeaderElector getLeaderElector() {
return new ZkLeaderElector(processorIdStr, zkUtils);
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
@Override
public LeaderElector getLeaderElector() {
return new ZkLeaderElector(processorIdStr, zkUtils);
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
@Override
public LeaderElector getLeaderElector() {
return new ZkLeaderElector(processorIdStr, zkUtils);
}
代码示例来源:origin: apache/samza
@Test
public void testUnregisteredProcessorInLeaderElection() {
String processorId = "1";
ZkUtils mockZkUtils = mock(ZkUtils.class);
when(mockZkUtils.getSortedActiveProcessorsZnodes()).thenReturn(new ArrayList<String>());
Mockito.doNothing().when(mockZkUtils).validatePaths(any(String[].class));
ZkKeyBuilder kb = mock(ZkKeyBuilder.class);
when(kb.getProcessorsPath()).thenReturn("");
when(mockZkUtils.getKeyBuilder()).thenReturn(kb);
ZkLeaderElector leaderElector = new ZkLeaderElector(processorId, mockZkUtils, null);
leaderElector.setLeaderElectorListener(() -> { });
try {
leaderElector.tryBecomeLeader();
Assert.fail("Was expecting leader election to fail!");
} catch (SamzaException e) {
// No-op Expected
}
}
代码示例来源:origin: apache/samza
@Test
public void testLeaderElectionRegistersProcessor() {
List<String> activeProcessors = new ArrayList<String>() {
{
add("0000000000");
}
};
ZkUtils mockZkUtils = mock(ZkUtils.class);
when(mockZkUtils.registerProcessorAndGetId(any())).
thenReturn(KEY_BUILDER.getProcessorsPath() + "/0000000000");
when(mockZkUtils.getSortedActiveProcessorsZnodes()).thenReturn(activeProcessors);
Mockito.doNothing().when(mockZkUtils).validatePaths(any(String[].class));
ZkKeyBuilder kb = mock(ZkKeyBuilder.class);
when(kb.getProcessorsPath()).thenReturn("");
when(mockZkUtils.getKeyBuilder()).thenReturn(kb);
ZkLeaderElector leaderElector = new ZkLeaderElector("1", mockZkUtils, null);
BooleanResult isLeader = new BooleanResult();
leaderElector.setLeaderElectorListener(() -> isLeader.res = true);
leaderElector.tryBecomeLeader();
Assert.assertTrue(TestZkUtils.testWithDelayBackOff(() -> isLeader.res, 2, 100));
}
代码示例来源:origin: org.apache.samza/samza-core
ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) {
this.config = config;
this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry);
this.processorId = createProcessorId(config);
this.zkUtils = zkUtils;
// setup a listener for a session state change
// we are mostly interested in "session closed" and "new session created" events
zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener());
leaderElector = new ZkLeaderElector(processorId, zkUtils);
leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl());
this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs();
this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId);
debounceTimer = new ScheduleAfterDebounceTime(processorId);
debounceTimer.setScheduledTaskCallback(throwable -> {
LOG.error("Received exception in debounce timer! Stopping the job coordinator", throwable);
stop();
});
this.barrier = new ZkBarrierForVersionUpgrade(zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl(), debounceTimer);
systemAdmins = new SystemAdmins(config);
streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance());
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) {
this.config = config;
this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry);
this.processorId = createProcessorId(config);
this.zkUtils = zkUtils;
// setup a listener for a session state change
// we are mostly interested in "session closed" and "new session created" events
zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener());
leaderElector = new ZkLeaderElector(processorId, zkUtils);
leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl());
this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs();
this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId);
debounceTimer = new ScheduleAfterDebounceTime(processorId);
debounceTimer.setScheduledTaskCallback(throwable -> {
LOG.error("Received exception in debounce timer! Stopping the job coordinator", throwable);
stop();
});
this.barrier = new ZkBarrierForVersionUpgrade(zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl(), debounceTimer);
systemAdmins = new SystemAdmins(config);
streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance());
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) {
this.config = config;
this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry);
this.processorId = createProcessorId(config);
this.zkUtils = zkUtils;
// setup a listener for a session state change
// we are mostly interested in "session closed" and "new session created" events
zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener());
leaderElector = new ZkLeaderElector(processorId, zkUtils);
leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl());
this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs();
this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId);
debounceTimer = new ScheduleAfterDebounceTime(processorId);
debounceTimer.setScheduledTaskCallback(throwable -> {
LOG.error("Received exception in debounce timer! Stopping the job coordinator", throwable);
stop();
});
this.barrier = new ZkBarrierForVersionUpgrade(zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl(), debounceTimer);
systemAdmins = new SystemAdmins(config);
streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance());
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) {
this.config = config;
this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry);
this.processorId = createProcessorId(config);
this.zkUtils = zkUtils;
// setup a listener for a session state change
// we are mostly interested in "session closed" and "new session created" events
zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener());
leaderElector = new ZkLeaderElector(processorId, zkUtils);
leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl());
this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs();
this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId);
debounceTimer = new ScheduleAfterDebounceTime(processorId);
debounceTimer.setScheduledTaskCallback(throwable -> {
LOG.error("Received exception in debounce timer! Stopping the job coordinator", throwable);
stop();
});
this.barrier = new ZkBarrierForVersionUpgrade(zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl(), debounceTimer);
systemAdmins = new SystemAdmins(config);
streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance());
}
代码示例来源:origin: apache/samza
ZkLeaderElector leaderElector1 = new ZkLeaderElector("1", zkUtils1, null);
leaderElector1.setLeaderElectorListener(() -> isLeader1.res = true);
ZkLeaderElector leaderElector2 = new ZkLeaderElector("2", zkUtils2, null);
leaderElector2.setLeaderElectorListener(() -> isLeader2.res = true);
ZkLeaderElector leaderElector3 = new ZkLeaderElector("3", zkUtils3, null);
leaderElector3.setLeaderElectorListener(() -> isLeader3.res = true);
代码示例来源:origin: apache/samza
@Test
public void testZKProtocolVersion() {
ZkLeaderElector le = new ZkLeaderElector("1", zkUtils);
zkUtils.validateZkVersion();
代码示例来源:origin: apache/samza
ZkJobCoordinator(String processorId, Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) {
this.config = config;
this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry);
this.zkSessionMetrics = new ZkSessionMetrics(metricsRegistry);
this.processorId = processorId;
this.zkUtils = zkUtils;
// setup a listener for a session state change
// we are mostly interested in "session closed" and "new session created" events
zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener());
leaderElector = new ZkLeaderElector(processorId, zkUtils);
leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl());
this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs();
debounceTimer = new ScheduleAfterDebounceTime(processorId);
debounceTimer.setScheduledTaskCallback(throwable -> {
LOG.error("Received exception in debounce timer! Stopping the job coordinator", throwable);
stop();
});
this.barrier = new ZkBarrierForVersionUpgrade(zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl(), debounceTimer);
systemAdmins = new SystemAdmins(config);
streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance());
LocationIdProviderFactory locationIdProviderFactory = Util.getObj(new JobConfig(config).getLocationIdProviderFactory(), LocationIdProviderFactory.class);
LocationIdProvider locationIdProvider = locationIdProviderFactory.getLocationIdProvider(config);
this.locationId = locationIdProvider.getLocationId();
}
代码示例来源:origin: apache/samza
ZkLeaderElector leaderElector1 = new ZkLeaderElector("processor1", zkUtils1, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data) throws Exception { }
ZkLeaderElector leaderElector2 = new ZkLeaderElector("processor2", zkUtils2, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data) throws Exception { }
ZkLeaderElector leaderElector3 = new ZkLeaderElector("processor3", zkUtils3, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data) throws Exception { }
代码示例来源:origin: apache/samza
@Test
public void testAmILeader() {
BooleanResult isLeader1 = new BooleanResult();
BooleanResult isLeader2 = new BooleanResult();
// Processor-1
ZkUtils zkUtils1 = getZkUtilsWithNewClient();
ZkLeaderElector leaderElector1 = new ZkLeaderElector("1", zkUtils1, null);
leaderElector1.setLeaderElectorListener(() -> isLeader1.res = true);
// Processor-2
ZkUtils zkUtils2 = getZkUtilsWithNewClient();
ZkLeaderElector leaderElector2 = new ZkLeaderElector("2", zkUtils2, null);
leaderElector2.setLeaderElectorListener(() -> isLeader2.res = true);
// Before Leader Election
Assert.assertFalse(leaderElector1.amILeader());
Assert.assertFalse(leaderElector2.amILeader());
leaderElector1.tryBecomeLeader();
leaderElector2.tryBecomeLeader();
// After Leader Election
Assert.assertTrue(leaderElector1.amILeader());
Assert.assertFalse(leaderElector2.amILeader());
zkUtils1.close();
zkUtils2.close();
}
代码示例来源:origin: apache/samza
ZkLeaderElector leaderElector1 = new ZkLeaderElector("processor1", zkUtils1, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data)
ZkLeaderElector leaderElector2 = new ZkLeaderElector("processor2", zkUtils2, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data)
ZkLeaderElector leaderElector3 = new ZkLeaderElector("processor3", zkUtils3, new IZkDataListener() {
@Override
public void handleDataChange(String dataPath, Object data)
我正在关注Apache Samza website上的hello-samza教程,并想按此处所述添加REST服务:http://samza.apache.org/learn/tutorials/lat
您好,由于以下错误 ,我的 samza 作业容器经常失败: Exception from container-launch. Container id: container_1540535314451
如果您使用 Samza 的 OutgoingMessageEnvelope使用此格式发送消息: public OutgoingMessageEnvelope(SystemStream systemSt
使用 Samza KeyValueStore接口(interface),如何检索具有公共(public)键前缀的所有文档?键是字符串,RocksDb 将是底层存储。 下面使用 range 方法的方法是
我正在尝试设置 Apache Samza 和 Kafka 环境。我在尝试运行模块时遇到了一些问题。 我让 Kafka 正常工作,但我无法让 Samza 工作。我已经安装了两个 Debian Jeesy
我目前正在编写一个 Samza 脚本,它只会从 Kafka 主题获取数据并将数据输出到另一个 Kafka 主题。我写了一个非常基本的 StreamTask 但是在执行时我遇到了错误。 错误如下: Ex
本文整理了Java中org.apache.samza.zk.ZkCoordinationUtilsFactory类的一些代码示例,展示了ZkCoordinationUtilsFactory类的具体用法
本文整理了Java中org.apache.samza.zk.ZkProcessorLatch类的一些代码示例,展示了ZkProcessorLatch类的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中org.apache.samza.zk.ZkUtils类的一些代码示例,展示了ZkUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
本文整理了Java中org.apache.samza.zk.ZkLeaderElector类的一些代码示例,展示了ZkLeaderElector类的具体用法。这些代码示例主要来源于Github/Sta
本文整理了Java中org.apache.samza.zk.ZkKeyBuilder类的一些代码示例,展示了ZkKeyBuilder类的具体用法。这些代码示例主要来源于Github/Stackover
本文整理了Java中org.apache.samza.zk.ZkJobCoordinator类的一些代码示例,展示了ZkJobCoordinator类的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中org.apache.samza.zk.ZkBarrierForVersionUpgrade类的一些代码示例,展示了ZkBarrierForVersionUpgrade类的具体用法
本文整理了Java中org.apache.samza.zk.ZkDistributedLock类的一些代码示例,展示了ZkDistributedLock类的具体用法。这些代码示例主要来源于Github
本文整理了Java中org.apache.samza.zk.ZkBarrierListener类的一些代码示例,展示了ZkBarrierListener类的具体用法。这些代码示例主要来源于Github
本文整理了Java中org.apache.samza.zk.ZkUtilsMetrics类的一些代码示例,展示了ZkUtilsMetrics类的具体用法。这些代码示例主要来源于Github/Stack
本文整理了Java中org.apache.samza.zk.ZkCoordinationUtils类的一些代码示例,展示了ZkCoordinationUtils类的具体用法。这些代码示例主要来源于Gi
本文整理了Java中org.apache.samza.zk.ZkJobCoordinatorFactory类的一些代码示例,展示了ZkJobCoordinatorFactory类的具体用法。这些代码示
本文整理了Java中org.apache.samza.config.ZkConfig类的一些代码示例,展示了ZkConfig类的具体用法。这些代码示例主要来源于Github/Stackoverflow
本文整理了Java中org.apache.samza.zk.ZkMetadataStore类的一些代码示例,展示了ZkMetadataStore类的具体用法。这些代码示例主要来源于Github/Sta
我是一名优秀的程序员,十分优秀!