T - the type of data emitted by the observed source PublisherSTATE - the type of the publisher-level state that will be shared between all SignalListener created by this factorypublic interface SignalListenerFactory<T,STATE>
SignalListener, exposing the ability to generate common state at publisher level
from the source Publisher.
Examples of such state include:
SignalListener| Modifier and Type | Method and Description |
|---|---|
SignalListener<T> |
createListener(Publisher<? extends T> source,
ContextView listenerContext,
STATE publisherContext)
|
STATE |
initializePublisherState(Publisher<? extends T> source)
Create the
STATE object for the given Publisher. |
STATE initializePublisherState(Publisher<? extends T> source)
STATE object for the given Publisher. This assumes this factory will only be used on
that particular source, allowing all SignalListener created by this factory to inherit the common state.source - the source Publisher this factory is attached to.SignalListener<T> createListener(Publisher<? extends T> source, ContextView listenerContext, STATE publisherContext)
SignalListener each time a new Subscriber subscribes to the
source Publisher.
The source Publisher is the same as the one that triggered common state creation at assembly time in
initializePublisherState(Publisher)). Said common state is passed to this method as well, and so is the
ContextView for the newly registered CoreSubscriber.
source - the source Publisher that is being subscribed tolistenerContext - the ContextView associated with the new subscriberpublisherContext - the common state initialized in initializePublisherState(Publisher)SignalListener observing signals to and from the new subscriber