X - The type of objects published by the Publisher and therefore used by the StreamId
implementationT - The class of StreamId to be used in the constrution of Publishers.public interface TypedStreamFactory<X,T extends StreamId<X>> extends StreamFactory
StreamFactory. A StreamFactory can create any type of streams, but sometimes there
are scenarios in which the type of the StreamId and the data type of the Publisher to be created are
known. In those cases, TypedStreamFactory can simplify the development of a StreamFactory. The
StreamFactory.create(StreamId, DiscoveryService) method is provided with a default implementation that suites
most use cases.| Modifier and Type | Method and Description |
|---|---|
default <Y> java.util.Optional<org.reactivestreams.Publisher<Y>> |
create(StreamId<Y> id,
DiscoveryService discoveryService)
Default implementation of the
StreamFactory.create(StreamId, DiscoveryService) method. |
org.reactivestreams.Publisher<X> |
createReactiveStream(T id,
DiscoveryService discoveryService)
Actually create the
ReactiveStream from the given id. |
java.lang.Class<T> |
streamIdClass()
Returns the class that this
TypedStreamFactory is able to create. |
default <Y> java.util.Optional<org.reactivestreams.Publisher<Y>> create(StreamId<Y> id, DiscoveryService discoveryService)
StreamFactory.create(StreamId, DiscoveryService) method. Is uses
createReactiveStream(StreamId, DiscoveryService) and streamIdClass() to provide a more
developer friendly way of creating ReactiveStreams.create in interface StreamFactoryid - 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 idorg.reactivestreams.Publisher<X> createReactiveStream(T id, DiscoveryService discoveryService)
ReactiveStream from the given id. It is much like
StreamFactory.create(StreamId, DiscoveryService) but with typed StreamId.java.lang.Class<T> streamIdClass()
TypedStreamFactory is able to create.