T
- type of the observed event@FunctionalInterface public interface Observer<T>
Observable
. Once registered,
it will receive all events currently in the backing Ringbuffer
and then continue receiving any future events.
Jet calls this Observer
's callbacks on an internal thread pool
of limited size, shared with many other Hazelcast Jet services. Therefore
the callbacks should take care to finish as quickly as possible.
Modifier and Type | Method and Description |
---|---|
static <T> Observer<T> |
of(ConsumerEx<? super T> onNext)
Utility method for building an
Observer only from its data
callback, with default behaviour for completion & error. |
static <T> Observer<T> |
of(ConsumerEx<? super T> onNext,
ConsumerEx<? super Throwable> onError,
RunnableEx onComplete)
Utility method for building an
Observer from its basic
callback components. |
default void |
onComplete()
Observes the completion event from the
Observable it is
registered with. |
default void |
onError(Throwable throwable)
Observes an error event from the
Observable it is registered
with, in the form of an exception that reflects the underlying cause. |
void |
onNext(T t)
Observes the next event from the
Observable it is registered
with. |
@Nonnull static <T> Observer<T> of(@Nonnull ConsumerEx<? super T> onNext, @Nonnull ConsumerEx<? super Throwable> onError, @Nonnull RunnableEx onComplete)
Observer
from its basic
callback components.@Nonnull static <T> Observer<T> of(@Nonnull ConsumerEx<? super T> onNext)
Observer
only from its data
callback, with default behaviour for completion & error.void onNext(@Nonnull T t)
Observable
it is registered
with.
Although the Observable
respects the order of events published
to it, the publication order itself is generally non-deterministic. A
Jet pipeline must be written with the specific goal of order
preservation in mind. For example, a map/filter stage that doesn't
explicitly set its local parallelism to 1 will reorder the data.
After this observer has seen an error or completion event, it will see no further events.
default void onError(@Nonnull Throwable throwable)
Observable
it is registered
with, in the form of an exception that reflects the underlying cause.
After this observer has seen an error or completion event, it will see no further events.
default void onComplete()
Observable
it is
registered with. Only an observer attached to a batch job will ever see
this event. Unbounded streaming jobs never complete without error.
After this observer has seen an error or completion event, it will see no further events.
Copyright © 2023 Hazelcast, Inc.. All rights reserved.