use of com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_CURRENT in project hazelcast-jet-reference-manual by hazelcast.
the class BuildComputation method s14.
static void s14() {
// tag::s14[]
Pipeline p = Pipeline.create();
p.<Tweet>drawFrom(Sources.mapJournal("tweets", mapPutEvents(), mapEventNewValue(), START_FROM_CURRENT)).flatMap(tweet -> traverseArray(tweet.text().toLowerCase().split("\\W+")).map(word -> new TweetWord(tweet.timestamp(), word))).filter(tweetWord -> !tweetWord.word().isEmpty()).addTimestamps(TweetWord::timestamp, TimeUnit.SECONDS.toMillis(5)).window(sliding(MINUTES.toMillis(1), SECONDS.toMillis(1))).groupingKey(TweetWord::word).aggregate(counting()).drainTo(Sinks.list("result"));
// end::s14[]
}
use of com.hazelcast.jet.pipeline.JournalInitialPosition.START_FROM_CURRENT 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.JournalInitialPosition.START_FROM_CURRENT in project hazelcast-jet-reference-manual by hazelcast.
the class BuildComputation method s13.
static void s13() {
// tag::s13[]
Pipeline p = Pipeline.create();
p.<String>drawFrom(Sources.mapJournal("tweets", mapPutEvents(), mapEventNewValue(), START_FROM_CURRENT)).flatMap(line -> traverseArray(line.toLowerCase().split("\\W+"))).filter(word -> !word.isEmpty()).addTimestamps().window(sliding(MINUTES.toMillis(1), SECONDS.toMillis(1))).groupingKey(wholeItem()).aggregate(counting()).drainTo(Sinks.list("result"));
// end::s13[]
}
Aggregations