Class AsyncMulticastEventStreamPublisher<K,V>
- java.lang.Object
-
- io.streamthoughts.azkarra.api.events.reactive.AsyncMulticastEventStreamPublisher<K,V>
-
- All Implemented Interfaces:
EventStreamPublisher<K,V>
,Flow.Publisher<KV<K,V>>
public class AsyncMulticastEventStreamPublisher<K,V> extends Object implements EventStreamPublisher<K,V>
The AsyncMulticastEventStreamPublisher is an implementation of Reactive StreamsFlow.Publisher
which executes asynchronously, using an internal single-threadExecutor
. Records are produced from a givenEventStream
in a "multicast" configuration to itsFlow.Subscriber
. Note: A subscriber will start receiving events from the head of the event-stream buffer, as soon as it perform a valid request demand. The publisher will continue to poll the event-stream buffer as long as at-least one subscriber is requesting more records, i.e even if other subscriptions are applying back-pressure.- Since:
- 0.8.0
-
-
Constructor Summary
Constructors Constructor Description AsyncMulticastEventStreamPublisher(EventStream<K,V> stream)
Creates a newAsyncMulticastEventStreamPublisher
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
subscribe(Flow.Subscriber<? super KV<K,V>> subscriber)
String
type()
Get the event type name attached to this publisher.
-
-
-
Constructor Detail
-
AsyncMulticastEventStreamPublisher
public AsyncMulticastEventStreamPublisher(EventStream<K,V> stream)
Creates a newAsyncMulticastEventStreamPublisher
instance.- Parameters:
stream
- theEventStream
.
-
-
Method Detail
-
type
public String type()
Get the event type name attached to this publisher.- Specified by:
type
in interfaceEventStreamPublisher<K,V>
- Returns:
- the event type name.
-
subscribe
public void subscribe(Flow.Subscriber<? super KV<K,V>> subscriber)
- Specified by:
subscribe
in interfaceEventStreamPublisher<K,V>
- Specified by:
subscribe
in interfaceFlow.Publisher<K>
-
-