Package com.hazelcast.jet
Class Util
java.lang.Object
com.hazelcast.jet.Util
Miscellaneous utility methods useful in DAG building logic.
- Since:
- Jet 3.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> FunctionEx<EventJournalCacheEvent<K, V>, V> Returns a projection that extracts the new value from anEventJournalCacheEvent
.static <K,
V> FunctionEx<EventJournalCacheEvent<K, V>, Map.Entry<K, V>> Returns a projection that converts theEventJournalCacheEvent
to aMap.Entry
using the event's new value as a value.static <K,
V> PredicateEx<EventJournalCacheEvent<K, V>> Returns a predicate forSources.cacheJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
andSources.remoteCacheJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
that passes onlyCREATED
andUPDATED
events.static <K,
V> Map.Entry<K, V> entry
(K k, V v) Returns aMap.Entry
with the given key and value.static Path
getFilePathOfClasspathResource
(String resourcePath) Takes the pathname of a classpath resource and returns aPath
that corresponds to it.static long
idFromString
(String str) Parses the jobId formatted withidToString(long)
.static String
idToString
(long id) Converts along
job or execution ID to a string representation.static <K,
V> FunctionEx<EventJournalMapEvent<K, V>, V> Returns a projection that extracts the new value from anEventJournalMapEvent
.static <K,
V> FunctionEx<EventJournalMapEvent<K, V>, Map.Entry<K, V>> Returns a projection that converts theEventJournalMapEvent
to aMap.Entry
using the event's new value as a value.static <K,
V> PredicateEx<EventJournalMapEvent<K, V>> Returns a predicate forSources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
andSources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
that passes onlyADDED
andUPDATED
events.
-
Method Details
-
entry
Returns aMap.Entry
with the given key and value. -
mapPutEvents
Returns a predicate forSources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
andSources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
that passes onlyADDED
andUPDATED
events. -
cachePutEvents
Returns a predicate forSources.cacheJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
andSources.remoteCacheJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
that passes onlyCREATED
andUPDATED
events. -
mapEventToEntry
Returns a projection that converts theEventJournalMapEvent
to aMap.Entry
using the event's new value as a value.- See Also:
-
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
mapEventNewValue
Returns a projection that extracts the new value from anEventJournalMapEvent
.- See Also:
-
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
cacheEventToEntry
Returns a projection that converts theEventJournalCacheEvent
to aMap.Entry
using the event's new value as a value.- See Also:
-
Sources.cacheJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
Sources.remoteCacheJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.cache.EventJournalCacheEvent<K, V>>)
-
cacheEventNewValue
Returns a projection that extracts the new value from anEventJournalCacheEvent
.- See Also:
-
Sources.mapJournal(java.lang.String, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
Sources.remoteMapJournal(java.lang.String, com.hazelcast.client.config.ClientConfig, com.hazelcast.jet.pipeline.JournalInitialPosition, com.hazelcast.function.FunctionEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>, ? extends T>, com.hazelcast.function.PredicateEx<? super com.hazelcast.map.EventJournalMapEvent<K, V>>)
-
idToString
Converts along
job or execution ID to a string representation. Currently it is an unsigned 16-digit hex number. -
idFromString
Parses the jobId formatted withidToString(long)
.The method is lenient: if the string doesn't match the structure of the ID generated by
idToString
or if the string is null, it will return -1.- Returns:
- the parsed ID or -1 if parsing failed.
-
getFilePathOfClasspathResource
Takes the pathname of a classpath resource and returns aPath
that corresponds to it. This works only for resources that represent files or directories on the local file system (i.e., the class loader returns afile:
URL).For example, if you have a project directory
src/main/resources/python
, the files in it will become classpath resources with the"python"
path prefix. CallinggetFilePathOfClasspathResource("python")
will return the full path to the above directory in the project.- Parameters:
resourcePath
- the pathname of the classpath resource- Returns:
- a
Path
pointing to the project directory corresponding to the pathname - Since:
- Jet 4.0
-