public interface StreamFactory
Publishers. An implementation of this interface is able to
create a stream given an implementation of StreamId and a DiscoveryService. During the creation of a
stream it is allowed to discover other streams. This allow the possibility to create streams that merge other streams
while performing transformations.
NOTE: it is not allowed to discover other streams using the provided DiscoveryService in
multiple threads. In other words, do not use new threads inside the stream creation. The provided
DiscoveryService checks that subsequent discoveries are performed on the same thread, otherwise an exception
is risen. It is not possible to enforce the single thread execution in the
create(StreamId, DiscoveryService) method, but using the DiscoveryService from different threads may
lead to unpredictable behavior and can cause deadlocks.| Modifier and Type | Method and Description |
|---|---|
<T> java.util.Optional<org.reactivestreams.Publisher<T>> |
create(StreamId<T> id,
DiscoveryService discoveryService)
|
<T> java.util.Optional<org.reactivestreams.Publisher<T>> create(StreamId<T> id, DiscoveryService discoveryService)
StreamId and a DiscoveryService this method creates a
ReactiveStream. The provided DiscoveryService can be used to discover other streams that are
needed in the creation process (stream combination, transformation, etc.)
NOTE: it is strongly discouraged the use of multiple threads inside this method (see
TypedStreamFactory documentation).id - the id of the stream to creatediscoveryService - DiscoveryService which can be used by the factory to look up other streams
('upstream' of the one it will create)null if this factory cannot create the stream of the given id