Interface JobStreamer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A
JobStreamer
allows the engine to push data back to a single gateway (any). It keeps
track of multiple JobStreamer.JobStream
instances, each with their own jobType.
NOTE: JobStreamer.JobStream.push(ActivatedJob)
is a side effect, and should be treated as a
post-commit task for consistency. TODO: see if the platform cannot already enforce with its own
implementation.
NOTE: implementations of the JobStreamer.JobStream.push(ActivatedJob)
method are likely
asynchronous.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
AJobStreamer.JobStream
allows consumers to push out activated jobs. -
Method Summary
Modifier and TypeMethodDescriptionstatic JobStreamer
noop()
default void
notifyWorkAvailable
(String jobType) Can be used to notify listeners that there are jobs available for activation.default Optional
<JobStreamer.JobStream> streamFor
(org.agrona.DirectBuffer jobType) Returns a job stream for the job type, orOptional.empty()
if there is none.streamFor
(org.agrona.DirectBuffer jobType, Predicate<JobActivationProperties> filter) Returns a job stream for the job type, orOptional.empty()
if there is none.
-
Method Details
-
noop
-
notifyWorkAvailable
Can be used to notify listeners that there are jobs available for activation.- Parameters:
jobType
- the type of the stream which has items available
-
streamFor
Optional<JobStreamer.JobStream> streamFor(org.agrona.DirectBuffer jobType, Predicate<JobActivationProperties> filter) Returns a job stream for the job type, orOptional.empty()
if there is none.The predicate should return false to exclude job streams from the list of possible streams.
- Parameters:
jobType
- the job type to look forfilter
- a filter to include/exclude eligible job streams based on their properties- Returns:
- a job stream which matches the type and given filter, or
Optional.empty()
if none match
-
streamFor
Returns a job stream for the job type, orOptional.empty()
if there is none.
-