use of com.hazelcast.jet.pipeline.Sources in project hazelcast-jet-reference-manual by hazelcast.
the class ImdgConnectors method s14.
static void s14() {
JetInstance jet = Jet.newJetInstance();
// tag::s14[]
IList<Integer> inputList = jet.getList("inputList");
for (int i = 0; i < 10; i++) {
inputList.add(i);
}
Pipeline p = Pipeline.create();
p.drawFrom(Sources.<Integer>list("inputList")).map(i -> "item" + i).drainTo(Sinks.list("resultList"));
jet.newJob(p).join();
IList<String> resultList = jet.getList("resultList");
System.out.println("Results: " + new ArrayList<>(resultList));
// end::s14[]
}
use of com.hazelcast.jet.pipeline.Sources in project hazelcast-jet-reference-manual by hazelcast.
the class ImdgConnectors method s5.
static void s5() {
// tag::s5[]
Pipeline pipeline = Pipeline.create();
pipeline.drawFrom(Sources.<String, Integer>map("mymap")).drainTo(Sinks.mapWithEntryProcessor("mymap", Entry::getKey, entry -> new IncrementEntryProcessor(5)));
// end::s5[]
}
use of com.hazelcast.jet.pipeline.Sources in project hazelcast-jet-reference-manual by hazelcast.
the class LogDebug method s3.
static void s3() {
// tag::s3[]
Pipeline p = Pipeline.create();
p.drawFrom(Sources.<String>list("inputList")).flatMap(line -> traverseArray(line.toLowerCase().split("\\W+"))).filter(word -> !word.isEmpty()).peek().groupingKey(wholeItem()).aggregate(counting()).drainTo(Sinks.map("counts"));
// end::s3[]
// tag::s4[]
JetInstance jet = Jet.newJetInstance();
try {
jet.getList("inputList").addAll(asList("The quick brown fox", "jumped over the lazy dog"));
jet.newJob(p).join();
} finally {
Jet.shutdownAll();
}
// end::s4[]
}
use of com.hazelcast.jet.pipeline.Sources in project hazelcast-jet-reference-manual by hazelcast.
the class WhatIsDistributedComputing method s1.
static void s1() {
// tag::s1[]
Pattern delimiter = Pattern.compile("\\W+");
Pipeline p = Pipeline.create();
p.drawFrom(Sources.<Long, String>map("book-lines")).flatMap(e -> traverseArray(delimiter.split(e.getValue().toLowerCase()))).filter(word -> !word.isEmpty()).groupingKey(wholeItem()).aggregate(AggregateOperations.counting()).drainTo(Sinks.map("counts"));
// end::s1[]
}
Aggregations