Class EventStream<K,V>
- java.lang.Object
-
- io.streamthoughts.azkarra.api.events.EventStream<K,V>
-
- Type Parameters:
K
- the record key type.V
- the record value type.
public class EventStream<K,V> extends Object
A typed stream of events backed by aBlockingRecordQueue
.- Since:
- 0.8.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EventStream.Builder
-
Constructor Summary
Constructors Constructor Description EventStream(String type, BlockingRecordQueue<K,V> queue)
Creates a newEventStream
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
open(EventStreamPipe<K,V> pipe)
void
send(KV<K,V> kv)
Sends a null-key value record into this stream.void
send(K key, V value)
Sends a key-value record into this stream.void
send(K key, V value, long timestamp)
Sends a timestamped key-value record into this stream.void
send(V value)
Sends a key-value record into this queue.String
toString()
String
type()
-
-
-
Constructor Detail
-
EventStream
public EventStream(String type, BlockingRecordQueue<K,V> queue)
Creates a newEventStream
instance.- Parameters:
type
- the name of the events send to this stream.queue
- theBlockingRecordQueue
.
-
-
Method Detail
-
type
public String type()
- Returns:
- the name of the events send to this stream.
-
open
public void open(EventStreamPipe<K,V> pipe)
-
close
public void close()
-
send
public void send(V value)
Sends a key-value record into this queue.- Parameters:
value
- the record value.
-
send
public void send(K key, V value)
Sends a key-value record into this stream.- Parameters:
key
- the record key.value
- the record value.
-
send
public void send(K key, V value, long timestamp)
Sends a timestamped key-value record into this stream.- Parameters:
key
- the record key.value
- the record value.
-
send
public void send(KV<K,V> kv)
Sends a null-key value record into this stream.- Parameters:
kv
- theKV
record.
-
-