use of com.hazelcast.jet.kafka.KafkaSources in project hazelcast by hazelcast.
the class StreamKafkaPTest method when_projectionFunctionProvided_thenAppliedToReadRecords.
@Test
public void when_projectionFunctionProvided_thenAppliedToReadRecords() {
int messageCount = 20;
Pipeline p = Pipeline.create();
p.readFrom(KafkaSources.<Integer, String, String>kafka(properties(), rec -> rec.value() + "-x", topic1Name)).withoutTimestamps().writeTo(Sinks.list("sink"));
instance().getJet().newJob(p);
sleepAtLeastSeconds(3);
for (int i = 0; i < messageCount; i++) {
kafkaTestSupport.produce(topic1Name, i, Integer.toString(i));
}
IList<String> list = instance().getList("sink");
assertTrueEventually(() -> {
assertEquals(messageCount, list.size());
for (int i = 0; i < messageCount; i++) {
String value = i + "-x";
assertTrue("missing entry: " + value, list.contains(value));
}
}, 5);
}
Aggregations