use of com.hazelcast.jet.pipeline.Pipeline in project hazelcast-jet-reference-manual by hazelcast.
the class BuildComputation method s15.
static void s15() {
// tag::s15[]
Pipeline p = Pipeline.create();
p.<Tweet>drawFrom(Sources.mapJournal("tweets", mapPutEvents(), mapEventNewValue(), START_FROM_CURRENT)).addTimestamps(Tweet::timestamp, TimeUnit.SECONDS.toMillis(5)).flatMap(tweet -> traverseArray(tweet.text().toLowerCase().split("\\W+"))).filter(word -> !word.isEmpty()).window(sliding(MINUTES.toMillis(1), SECONDS.toMillis(1))).groupingKey(wholeItem()).aggregate(counting()).drainTo(Sinks.list("result"));
// end::s15[]
}
use of com.hazelcast.jet.pipeline.Pipeline in project hazelcast-jet-reference-manual by hazelcast.
the class BuildComputation method s3.
static void s3() {
// tag::s3[]
Pipeline p = Pipeline.create();
BatchStage<String> src = p.drawFrom(Sources.list("src"));
src.map(String::toUpperCase).drainTo(Sinks.list("uppercase"));
src.map(String::toLowerCase).drainTo(Sinks.list("lowercase"));
// end::s3[]
}
use of com.hazelcast.jet.pipeline.Pipeline in project hazelcast-jet-reference-manual by hazelcast.
the class BuildComputation method s6.
static void s6() {
// tag::s6[]
Pipeline p = Pipeline.create();
p.drawFrom(Sources.<String>list("text")).flatMap(line -> traverseArray(line.toLowerCase().split("\\W+"))).filter(word -> !word.isEmpty()).groupingKey(wholeItem()).aggregate(counting()).drainTo(Sinks.list("result"));
// end::s6[]
}
use of com.hazelcast.jet.pipeline.Pipeline in project hazelcast-jet-reference-manual by hazelcast.
the class Considerations method s8.
static void s8() {
// tag::s8[]
Pipeline p = Pipeline.create();
BatchStage<Long> src = p.drawFrom(Sources.list("input"));
ContextFactory<DateTimeFormatter> contextFactory = // <1>
ContextFactory.withCreateFn(x -> DateTimeFormatter.ofPattern("HH:mm:ss.SSS").withZone(ZoneId.systemDefault()));
// <2>
src.mapUsingContext(// <2>
contextFactory, // <3>
(formatter, tstamp) -> formatter.format(Instant.ofEpochMilli(tstamp)));
// end::s8[]
}
use of com.hazelcast.jet.pipeline.Pipeline in project hazelcast-jet-reference-manual by hazelcast.
the class ImdgConnectors method s4.
static void s4() {
// tag::s4[]
Pipeline pipeline = Pipeline.create();
pipeline.drawFrom(Sources.<String, Long>map("inMap")).drainTo(Sinks.<Entry<String, Long>, String, Long>mapWithUpdating("outMap", Entry::getKey, (oldV, item) -> (oldV != null ? oldV : 0L) + item.getValue()));
// end::s4[]
}
Aggregations