use of com.hazelcast.jet.JetInstance in project hazelcast-jet-reference-manual by hazelcast.
the class JUS method s3.
static void s3() {
JetInstance jet = Jet.newJetInstance();
// tag::s3[]
// <1>
IMapJet<String, String> map = jet.getMap("large_map");
Map<String, String> result = DistributedStream.fromMap(map).map(e -> e.getKey() + e.getValue()).collect(// <2>
DistributedCollectors.toMap(v -> v, v -> v));
// end::s3[]
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet-reference-manual by hazelcast.
the class JUS method s4.
static void s4() {
JetInstance jet = Jet.newJetInstance();
// tag::s4[]
IMap<String, Long> counts = DistributedStream.<String>fromList(jet.getList("text")).flatMap(line -> Stream.of(line.toLowerCase().split("\\W+"))).filter(word -> !word.isEmpty()).collect(DistributedCollectors.groupingByToIMap("counts", wholeItem(), DistributedCollectors.counting()));
// end::s4[]
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet-reference-manual by hazelcast.
the class JUS method s1.
static void s1() {
JetInstance jet = Jet.newJetInstance();
try {
// tag::s1[]
IMapJet<String, Integer> map = jet.getMap("latitudes");
map.put("London", 51);
map.put("Paris", 48);
map.put("NYC", 40);
map.put("Sydney", -34);
map.put("Sao Paulo", -23);
map.put("Jakarta", -6);
DistributedStream.fromMap(map).filter(e -> e.getValue() < 0).forEach(System.out::println);
// end::s1[]
} finally {
Jet.shutdownAll();
}
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet-reference-manual by hazelcast.
the class StartTwoInstances method s1.
static void s1() {
// tag::s1[]
JetInstance jet = Jet.newJetInstance();
Jet.newJetInstance();
// end::s1[]
}
use of com.hazelcast.jet.JetInstance in project hazelcast-jet-reference-manual by hazelcast.
the class S8 method main.
// end::s1[]
static void main() {
// tag::s2[]
JetInstance jet = Jet.newJetInstance();
int upperBound = 10;
DAG dag = new DAG();
Vertex generateNumbers = dag.newVertex("generate-numbers", () -> new GenerateNumbersP(upperBound));
Vertex logInput = dag.newVertex("log-input", DiagnosticProcessors.writeLoggerP(i -> "Received number: " + i));
dag.edge(Edge.between(generateNumbers, logInput));
try {
jet.newJob(dag).join();
} finally {
Jet.shutdownAll();
}
// end::s2[]
}
Aggregations