Class EventStreamSupport
- java.lang.Object
-
- io.streamthoughts.azkarra.api.events.EventStreamSupport
-
- All Implemented Interfaces:
EventStreamProvider
- Direct Known Subclasses:
ServerSentEventExample.WordCountPublisherTopology
public class EventStreamSupport extends Object implements EventStreamProvider
Base class forEventStreamProvider
. This class provides convenient methods to registerEventStream
and to send records.- Since:
- 0.8.0
-
-
Constructor Summary
Constructors Constructor Description EventStreamSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
voidaddEventStream(EventStream<K,V> eventStream)
protected void
addEventStreamsWithDefaults(String... types)
List<EventStream>
eventStreams()
Returns the list ofEventStream
<K,V>
voidsend(String type, KV<K,V> kv)
Sends a null-key value record into into the given stream.<K,V>
voidsend(String type, K key, V value)
Sends a key-value record into the given stream.<K,V>
voidsend(String type, K key, V value, long timestamp)
Sends a timestamped key-value record into the given stream.<K,V>
voidsend(String type, V value)
Sends a key-value record into this queue.protected void
setDefaultEventQueueLimitHandler(LimitHandler limitHandler)
Sets the defaultLimitHandler
that will be used for creatingEventStream
.protected void
setDefaultEventQueueSize(int queueSize)
Sets the default event queue size that will be used for creatingEventStream
.
-
-
-
Method Detail
-
eventStreams
public List<EventStream> eventStreams()
Returns the list ofEventStream
- Specified by:
eventStreams
in interfaceEventStreamProvider
- Returns:
- a list of
EventStream
. Must not returnnull
.
-
addEventStream
public <K,V> void addEventStream(EventStream<K,V> eventStream)
-
addEventStreamsWithDefaults
protected void addEventStreamsWithDefaults(String... types)
-
setDefaultEventQueueLimitHandler
protected void setDefaultEventQueueLimitHandler(LimitHandler limitHandler)
Sets the defaultLimitHandler
that will be used for creatingEventStream
.- Parameters:
limitHandler
- theLimitHandler
.
-
setDefaultEventQueueSize
protected void setDefaultEventQueueSize(int queueSize)
Sets the default event queue size that will be used for creatingEventStream
.- Parameters:
queueSize
- the queue size.
-
send
public <K,V> void send(String type, V value)
Sends a key-value record into this queue.- Parameters:
type
- the type of the event-stream.value
- the record value.
-
send
public <K,V> void send(String type, K key, V value)
Sends a key-value record into the given stream.- Parameters:
type
- the type of the event-stream.key
- the record key.value
- the record value.
-
send
public <K,V> void send(String type, K key, V value, long timestamp)
Sends a timestamped key-value record into the given stream.- Parameters:
type
- the type of the event-stream.key
- the record key.value
- the record value.
-
-