Package org.streamingpool.core.service
Interface StreamFactory
-
- All Known Subinterfaces:
TypedStreamFactory<X,T>
- All Known Implementing Classes:
CombineWithLatestStreamFactory,CompositionStreamFactory,CreatorStreamFactory,DelayedStreamFactory,DerivedStreamFactory,FanOutStreamFactory,FilteredStreamFactory,FlattenedStreamFactory,IntervalStreamFactory,MergedErrorStreamFactory,OverlapBufferStreamFactory,ZippedStreamFactory
public interface StreamFactoryThis interface represents a factory forPublishers. An implementation of this interface is able to create a stream given an implementation ofStreamIdand aDiscoveryService. 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
DiscoveryServicein multiple threads. In other words, do not use new threads inside the stream creation. The providedDiscoveryServicechecks 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 thecreate(StreamId, DiscoveryService)method, but using theDiscoveryServicefrom different threads may lead to unpredictable behavior and can cause deadlocks.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> ErrorStreamPair<T>create(StreamId<T> id, DiscoveryService discoveryService)
-
-
-
Method Detail
-
create
<T> ErrorStreamPair<T> create(StreamId<T> id, DiscoveryService discoveryService)
Given an implementation ofStreamIdand aDiscoveryServicethis method creates aPublisher. The providedDiscoveryServicecan 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
TypedStreamFactorydocumentation).- Parameters:
id- the id of the stream to creatediscoveryService-DiscoveryServicewhich can be used by the factory to look up other streams ('upstream' of the one it will create)- Returns:
- the newly created stream or
nullif this factory cannot create the stream of the given id
-
-