use of com.hazelcast.cache.journal.EventJournalCacheEvent in project hazelcast-jet by hazelcast.
the class HazelcastConnectorTest method when_streamCache_withFilterAndProjection.
@Test
public void when_streamCache_withFilterAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex("source", SourceProcessors.<Integer, Integer, Integer>streamCacheP(streamSourceName, event -> !event.getKey().equals(0), EventJournalCacheEvent::getKey, START_FROM_OLDEST, wmGenParams(i -> i, limitingLag(0), noThrottling(), 10_000)));
Vertex sink = dag.newVertex("sink", writeListP(streamSinkName));
dag.edge(between(source, sink));
Job job = jetInstance.newJob(dag);
ICacheJet<Integer, Integer> sourceCache = jetInstance.getCacheManager().getCache(streamSourceName);
range(0, ENTRY_COUNT).forEach(i -> sourceCache.put(i, i));
assertSizeEventually(ENTRY_COUNT - 1, jetInstance.getList(streamSinkName));
assertFalse(jetInstance.getList(streamSinkName).contains(0));
assertTrue(jetInstance.getList(streamSinkName).contains(1));
job.cancel();
}
use of com.hazelcast.cache.journal.EventJournalCacheEvent in project hazelcast-jet by hazelcast.
the class HazelcastRemoteConnectorTest method when_streamRemoteCache_withPredicateAndProjection.
@Test
public void when_streamRemoteCache_withPredicateAndProjection() {
DAG dag = new DAG();
Vertex source = dag.newVertex(SOURCE_NAME, SourceProcessors.<Integer, Integer, Integer>streamRemoteCacheP(SOURCE_NAME, clientConfig, event -> !event.getKey().equals(0), EventJournalCacheEvent::getKey, START_FROM_OLDEST, wmGenParams(i -> i, limitingLag(0), noThrottling(), 10_000)));
Vertex sink = dag.newVertex(SINK_NAME, writeListP(SINK_NAME));
dag.edge(between(source, sink));
Job job = jet.newJob(dag);
populateCache(hz.getCacheManager().getCache(SOURCE_NAME));
assertSizeEventually(ITEM_COUNT - 1, jet.getList(SINK_NAME));
assertFalse(jet.getList(SINK_NAME).contains(0));
assertTrue(jet.getList(SINK_NAME).contains(1));
job.cancel();
}
use of com.hazelcast.cache.journal.EventJournalCacheEvent in project hazelcast-jet-reference-manual by hazelcast.
the class ImdgConnectors method s12.
static void s12() {
// tag::s12[]
Pipeline p = Pipeline.create();
StreamStage<EventJournalMapEvent<String, Long>> allFromMap = p.drawFrom(Sources.<EventJournalMapEvent<String, Long>, String, Long>mapJournal("inputMap", DistributedFunctions.alwaysTrue(), DistributedFunction.identity(), START_FROM_CURRENT));
StreamStage<EventJournalCacheEvent<String, Long>> allFromCache = p.drawFrom(Sources.<EventJournalCacheEvent<String, Long>, String, Long>cacheJournal("inputMap", DistributedFunctions.alwaysTrue(), DistributedFunction.identity(), START_FROM_CURRENT));
// end::s12[]
}
Aggregations