- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.samza.zk.ZkJobCoordinator
类的一些代码示例,展示了ZkJobCoordinator
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkJobCoordinator
类的具体详情如下:
包路径:org.apache.samza.zk.ZkJobCoordinator
类名称:ZkJobCoordinator
[英]JobCoordinator for stand alone processor managed via Zookeeper.
[中]通过Zookeeper管理的独立处理器的JobCoordinator。
代码示例来源:origin: apache/samza
/**
* Instantiates an {@link ZkJobCoordinator} using the {@link Config}.
*
* @param config zookeeper configurations required for instantiating {@link ZkJobCoordinator}
* @return An instance of {@link ZkJobCoordinator}
*/
@Override
public JobCoordinator getJobCoordinator(String processorId, Config config, MetricsRegistry metricsRegistry) {
// TODO: Separate JC related configs into a "ZkJobCoordinatorConfig"
String jobCoordinatorZkBasePath = getJobCoordinationZkPath(config);
ZkUtils zkUtils = getZkUtils(config, metricsRegistry, jobCoordinatorZkBasePath);
LOG.debug("Creating ZkJobCoordinator with config: {}.", config);
return new ZkJobCoordinator(processorId, config, metricsRegistry, zkUtils);
}
代码示例来源:origin: apache/samza
@Override
public void onBarrierError(String version, Throwable t) {
LOG.error("Encountered error while attaining consensus on JobModel version " + version);
metrics.barrierError.inc();
stop();
}
}
代码示例来源:origin: org.apache.samza/samza-core
/**
* Called when the children of the given path changed.
*
* @param parentPath The parent path
* @param currentChildren The children or null if the root node (parent path) was deleted.
* @throws Exception
*/
@Override
public void doHandleChildChange(String parentPath, List<String> currentChildren)
throws Exception {
if (currentChildren == null) {
LOG.info("handleChildChange on path " + parentPath + " was invoked with NULL list of children");
} else {
LOG.info("ProcessorChangeHandler::handleChildChange - Path: {} Current Children: {} ", parentPath, currentChildren);
onProcessorChange(currentChildren);
}
}
}
代码示例来源: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.10
public void onBarrierStateChanged(final String version, ZkBarrierForVersionUpgrade.State state) {
LOG.info("JobModel version " + version + " obtained consensus successfully!");
metrics.barrierStateChange.inc();
metrics.singleBarrierRebalancingTime.update(System.nanoTime() - startTime);
if (ZkBarrierForVersionUpgrade.State.DONE.equals(state)) {
debounceTimer.scheduleAfterDebounceTime(barrierAction, 0, () -> {
LOG.info("pid=" + processorId + "new version " + version + " of the job model got confirmed");
// read the new Model
JobModel jobModel = getJobModel();
// start the container with the new model
if (coordinatorListener != null) {
coordinatorListener.onNewJobModel(processorId, jobModel);
}
});
} else {
if (ZkBarrierForVersionUpgrade.State.TIMED_OUT.equals(state)) {
// no-op for non-leaders
// for leader: make sure we do not stop - so generate a new job model
LOG.warn("Barrier for version " + version + " timed out.");
if (leaderElector.amILeader()) {
LOG.info("Leader will schedule a new job model generation");
debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> {
// actual actions to do are the same as onProcessorChange
doOnProcessorChange(new ArrayList<>());
});
}
}
}
}
代码示例来源:origin: apache/samza
@Test
public void testShouldStopPartitionCountMonitorWhenStoppingTheJobCoordinator() {
ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class);
ZkClient mockZkClient = Mockito.mock(ZkClient.class);
when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT);
ZkUtils zkUtils = Mockito.mock(ZkUtils.class);
when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder);
when(zkUtils.getZkClient()).thenReturn(mockZkClient);
when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(new JobModel(new MapConfig(), new HashMap<>()));
ScheduleAfterDebounceTime mockDebounceTimer = Mockito.mock(ScheduleAfterDebounceTime.class);
ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator("TEST_PROCESSOR_ID", new MapConfig(), new NoOpMetricsRegistry(), zkUtils));
StreamPartitionCountMonitor monitor = Mockito.mock(StreamPartitionCountMonitor.class);
zkJobCoordinator.debounceTimer = mockDebounceTimer;
zkJobCoordinator.streamPartitionCountMonitor = monitor;
zkJobCoordinator.stop();
Mockito.verify(monitor).stop();
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
public void onProcessorChange(List<String> processors) {
if (leaderElector.amILeader()) {
LOG.info("ZkJobCoordinator::onProcessorChange - list of processors changed. List size=" + processors.size());
debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> doOnProcessorChange(processors));
}
}
代码示例来源:origin: apache/samza
@Test
public void testShouldStartPartitionCountMonitorOnBecomingLeader() {
ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class);
ZkClient mockZkClient = Mockito.mock(ZkClient.class);
when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT);
ZkUtils zkUtils = Mockito.mock(ZkUtils.class);
when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder);
when(zkUtils.getZkClient()).thenReturn(mockZkClient);
when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(new JobModel(new MapConfig(), new HashMap<>()));
ScheduleAfterDebounceTime mockDebounceTimer = Mockito.mock(ScheduleAfterDebounceTime.class);
ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator("TEST_PROCESSOR_ID", new MapConfig(), new NoOpMetricsRegistry(), zkUtils));
StreamPartitionCountMonitor monitor = Mockito.mock(StreamPartitionCountMonitor.class);
zkJobCoordinator.debounceTimer = mockDebounceTimer;
zkJobCoordinator.streamPartitionCountMonitor = monitor;
when(zkJobCoordinator.getPartitionCountMonitor()).thenReturn(monitor);
ZkJobCoordinator.LeaderElectorListenerImpl listener = zkJobCoordinator.new LeaderElectorListenerImpl();
listener.onBecomingLeader();
Mockito.verify(monitor).start();
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
JobModel jobModel = generateNewJobModel(currentProcessorIds);
代码示例来源:origin: apache/samza
JobModel jobModel = generateNewJobModel(processorNodes);
storeConfigInCoordinatorStream();
hasCreatedStreams = true;
代码示例来源:origin: org.apache.samza/samza-core_2.11
@Override
public void start() {
ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
zkUtils.validateZkVersion();
zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
.getJobModelPathPrefix()});
startMetrics();
systemAdmins.start();
leaderElector.tryBecomeLeader();
zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
shutdownMetrics();
代码示例来源:origin: apache/samza
JobModel jobModel = getJobModel();
代码示例来源: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.11
public void onBarrierStateChanged(final String version, ZkBarrierForVersionUpgrade.State state) {
LOG.info("JobModel version " + version + " obtained consensus successfully!");
metrics.barrierStateChange.inc();
metrics.singleBarrierRebalancingTime.update(System.nanoTime() - startTime);
if (ZkBarrierForVersionUpgrade.State.DONE.equals(state)) {
debounceTimer.scheduleAfterDebounceTime(barrierAction, 0, () -> {
LOG.info("pid=" + processorId + "new version " + version + " of the job model got confirmed");
// read the new Model
JobModel jobModel = getJobModel();
// start the container with the new model
if (coordinatorListener != null) {
coordinatorListener.onNewJobModel(processorId, jobModel);
}
});
} else {
if (ZkBarrierForVersionUpgrade.State.TIMED_OUT.equals(state)) {
// no-op for non-leaders
// for leader: make sure we do not stop - so generate a new job model
LOG.warn("Barrier for version " + version + " timed out.");
if (leaderElector.amILeader()) {
LOG.info("Leader will schedule a new job model generation");
debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> {
// actual actions to do are the same as onProcessorChange
doOnProcessorChange(new ArrayList<>());
});
}
}
}
}
代码示例来源:origin: apache/samza
@Test
public void testFollowerShouldStopWhenNotPartOfGeneratedJobModel() throws Exception {
ZkKeyBuilder keyBuilder = Mockito.mock(ZkKeyBuilder.class);
ZkClient mockZkClient = Mockito.mock(ZkClient.class);
CountDownLatch jcShutdownLatch = new CountDownLatch(1);
when(keyBuilder.getJobModelVersionBarrierPrefix()).thenReturn(TEST_BARRIER_ROOT);
ZkUtils zkUtils = Mockito.mock(ZkUtils.class);
when(zkUtils.getKeyBuilder()).thenReturn(keyBuilder);
when(zkUtils.getZkClient()).thenReturn(mockZkClient);
when(zkUtils.getJobModel(TEST_JOB_MODEL_VERSION)).thenReturn(new JobModel(new MapConfig(), new HashMap<>()));
ZkJobCoordinator zkJobCoordinator = Mockito.spy(new ZkJobCoordinator("TEST_PROCESSOR_ID", new MapConfig(), new NoOpMetricsRegistry(), zkUtils));
doAnswer(new Answer<Void>() {
public Void answer(InvocationOnMock invocation) {
jcShutdownLatch.countDown();
return null;
}
}).when(zkJobCoordinator).stop();
final ZkJobCoordinator.ZkJobModelVersionChangeHandler zkJobModelVersionChangeHandler = zkJobCoordinator.new ZkJobModelVersionChangeHandler(zkUtils);
zkJobModelVersionChangeHandler.doHandleDataChange("path", TEST_JOB_MODEL_VERSION);
verify(zkJobCoordinator, Mockito.atMost(1)).stop();
assertTrue("Timed out waiting for JobCoordinator to stop", jcShutdownLatch.await(1, TimeUnit.MINUTES));
}
代码示例来源:origin: org.apache.samza/samza-core
public void onProcessorChange(List<String> processors) {
if (leaderElector.amILeader()) {
LOG.info("ZkJobCoordinator::onProcessorChange - list of processors changed. List size=" + processors.size());
debounceTimer.scheduleAfterDebounceTime(ON_PROCESSOR_CHANGE, debounceTimeMs, () -> doOnProcessorChange(processors));
}
}
代码示例来源:origin: org.apache.samza/samza-core
JobModel jobModel = generateNewJobModel(currentProcessorIds);
代码示例来源:origin: org.apache.samza/samza-core_2.12
@Override
public void start() {
ZkKeyBuilder keyBuilder = zkUtils.getKeyBuilder();
zkUtils.validateZkVersion();
zkUtils.validatePaths(new String[]{keyBuilder.getProcessorsPath(), keyBuilder.getJobModelVersionPath(), keyBuilder
.getJobModelPathPrefix()});
startMetrics();
systemAdmins.start();
leaderElector.tryBecomeLeader();
zkUtils.subscribeToJobModelVersionChange(new ZkJobModelVersionChangeHandler(zkUtils));
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
shutdownMetrics();
我正在关注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
我是一名优秀的程序员,十分优秀!