use of org.apache.kafka.streams.processor.internals.namedtopology.TopologyConfig in project kafka by apache.
the class StreamTaskTest method createDisconnectedTask.
private StreamTask createDisconnectedTask(final StreamsConfig config) {
final MockKeyValueStore stateStore = new MockKeyValueStore(storeName, false);
final ProcessorTopology topology = ProcessorTopologyFactories.with(asList(source1, source2), mkMap(mkEntry(topic1, source1), mkEntry(topic2, source2)), singletonList(stateStore), emptyMap());
final MockConsumer<byte[], byte[]> consumer = new MockConsumer<byte[], byte[]>(OffsetResetStrategy.EARLIEST) {
@Override
public Map<TopicPartition, OffsetAndMetadata> committed(final Set<TopicPartition> partitions) {
throw new TimeoutException("KABOOM!");
}
};
final InternalProcessorContext context = new ProcessorContextImpl(taskId, config, stateManager, streamsMetrics, null);
return new StreamTask(taskId, partitions, topology, consumer, new TopologyConfig(null, config, new Properties()).getTaskConfig(), streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector, context, logContext);
}
use of org.apache.kafka.streams.processor.internals.namedtopology.TopologyConfig in project kafka by apache.
the class StreamTaskTest method createSingleSourceStateless.
private StreamTask createSingleSourceStateless(final StreamsConfig config, final String builtInMetricsVersion) {
final ProcessorTopology topology = withSources(asList(source1, processorStreamTime, processorSystemTime), mkMap(mkEntry(topic1, source1)));
source1.addChild(processorStreamTime);
source1.addChild(processorSystemTime);
EasyMock.expect(stateManager.changelogPartitions()).andReturn(Collections.emptySet());
EasyMock.expect(stateManager.changelogOffsets()).andReturn(Collections.emptyMap()).anyTimes();
EasyMock.expect(recordCollector.offsets()).andReturn(Collections.emptyMap()).anyTimes();
EasyMock.replay(stateManager, recordCollector);
final InternalProcessorContext context = new ProcessorContextImpl(taskId, config, stateManager, streamsMetrics, null);
return new StreamTask(taskId, mkSet(partition1), topology, consumer, new TopologyConfig(null, config, new Properties()).getTaskConfig(), new StreamsMetricsImpl(metrics, "test", builtInMetricsVersion, time), stateDirectory, cache, time, stateManager, recordCollector, context, logContext);
}
use of org.apache.kafka.streams.processor.internals.namedtopology.TopologyConfig in project kafka by apache.
the class StreamTaskTest method createStatefulTask.
private StreamTask createStatefulTask(final StreamsConfig config, final boolean logged, final ProcessorStateManager stateManager) {
final MockKeyValueStore stateStore = new MockKeyValueStore(storeName, logged);
final ProcessorTopology topology = ProcessorTopologyFactories.with(asList(source1, source2), mkMap(mkEntry(topic1, source1), mkEntry(topic2, source2)), singletonList(stateStore), logged ? Collections.singletonMap(storeName, storeName + "-changelog") : Collections.emptyMap());
final InternalProcessorContext context = new ProcessorContextImpl(taskId, config, stateManager, streamsMetrics, null);
return new StreamTask(taskId, partitions, topology, consumer, new TopologyConfig(null, config, new Properties()).getTaskConfig(), streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector, context, logContext);
}
use of org.apache.kafka.streams.processor.internals.namedtopology.TopologyConfig in project kafka by apache.
the class StreamTaskTest method createFaultyStatefulTask.
private StreamTask createFaultyStatefulTask(final StreamsConfig config) {
final ProcessorTopology topology = ProcessorTopologyFactories.with(asList(source1, source3), mkMap(mkEntry(topic1, source1), mkEntry(topic2, source3)), singletonList(stateStore), emptyMap());
final InternalProcessorContext context = new ProcessorContextImpl(taskId, config, stateManager, streamsMetrics, null);
return new StreamTask(taskId, partitions, topology, consumer, new TopologyConfig(null, config, new Properties()).getTaskConfig(), streamsMetrics, stateDirectory, cache, time, stateManager, recordCollector, context, logContext);
}
use of org.apache.kafka.streams.processor.internals.namedtopology.TopologyConfig in project kafka by apache.
the class StandbyTaskTest method createStandbyTask.
private StandbyTask createStandbyTask() {
final ThreadCache cache = new ThreadCache(new LogContext(String.format("stream-thread [%s] ", Thread.currentThread().getName())), 0, streamsMetrics);
final InternalProcessorContext context = new ProcessorContextImpl(taskId, config, stateManager, streamsMetrics, cache);
return new StandbyTask(taskId, Collections.singleton(partition), topology, new TopologyConfig(config).getTaskConfig(), streamsMetrics, stateManager, stateDirectory, cache, context);
}
Aggregations