Class CreatorStreamFactory
- java.lang.Object
-
- org.streamingpool.core.service.streamfactory.CreatorStreamFactory
-
- All Implemented Interfaces:
CreatorProvidingService,StreamFactory
public class CreatorStreamFactory extends java.lang.Object implements CreatorProvidingService, StreamFactory
TypedStreamFactoryspecifically designed to createPublishers usingStreamCreators. In order to use the rightStreamCreatorfor creating thePublisher, it usesImmutableIdentifiedStreamCreatorto map a specificStreamIdto the correspondentStreamCreator.- See Also:
StreamCreator,ImmutableIdentifiedStreamCreator
-
-
Constructor Summary
Constructors Constructor Description CreatorStreamFactory(java.lang.Iterable<IdentifiedStreamCreator<?>> identifiedCreators)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> ErrorStreamPair<T>create(StreamId<T> newId, DiscoveryService discoveryService)<T> voidprovide(StreamId<T> id, StreamCreator<T> streamSupplier)Provides aStreamCreatorassociated to the specified id.
-
-
-
Constructor Detail
-
CreatorStreamFactory
public CreatorStreamFactory(java.lang.Iterable<IdentifiedStreamCreator<?>> identifiedCreators)
-
-
Method Detail
-
create
public <T> ErrorStreamPair<T> create(StreamId<T> newId, DiscoveryService discoveryService)
Description copied from interface:StreamFactoryGiven 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).- Specified by:
createin interfaceStreamFactory- Parameters:
newId- 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
-
provide
public <T> void provide(StreamId<T> id, StreamCreator<T> streamSupplier)
Description copied from interface:CreatorProvidingServiceProvides aStreamCreatorassociated to the specified id.- Specified by:
providein interfaceCreatorProvidingService- Parameters:
id- the identifier of the stream that theStreamCreatorwill createstreamSupplier- theStreamCreatorthat is able to create thePublisherspecified using the given id
-
-