use of org.apache.samza.task.AsyncStreamTaskFactory in project samza by apache.
the class TestStreamProcessor method testStreamProcessorWithAsyncStreamTaskFactory.
/**
* Should be able to create task instances from the provided task factory.
*/
@Test
public void testStreamProcessorWithAsyncStreamTaskFactory() {
final String testSystem = "test-system";
final String inputTopic = "numbers3";
final String outputTopic = "output3";
final int messageCount = 20;
final Config configs = new MapConfig(createConfigs("1", testSystem, inputTopic, outputTopic, messageCount));
final ExecutorService executorService = Executors.newSingleThreadExecutor();
createTopics(inputTopic, outputTopic);
final AsyncStreamTaskFactory stf = () -> new AsyncStreamTaskAdapter(new IdentityStreamTask(), executorService);
final StreamProcessor processor = new StreamProcessor(configs, new HashMap<>(), stf, listener);
produceMessages(inputTopic, messageCount);
run(processor, endLatch);
verifyNumMessages(outputTopic, messageCount);
executorService.shutdownNow();
}
Aggregations