public class KafkaMessageStream extends Object implements TrackingEventStream
KafkaTrackingTokenRecords are fetched from kafka and stored in-memory
buffer.
This is not thread safe
| Constructor and Description |
|---|
KafkaMessageStream(Buffer<KafkaEventMessage> buffer,
Runnable closeHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
hasNextAvailable(int timeout,
TimeUnit unit)
Checks whether or not the next message in the stream is available.
|
TrackedEventMessage<?> |
nextAvailable()
Returns the next available message in the stream.
|
Optional<TrackedEventMessage<?>> |
peek()
Checks whether or not the next message in the stream is immediately available.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasStream, hasNextAvailablepublic KafkaMessageStream(Buffer<KafkaEventMessage> buffer, Runnable closeHandler)
public Optional<TrackedEventMessage<?>> peek()
MessageStreampeek in interface MessageStream<TrackedEventMessage<?>>public boolean hasNextAvailable(int timeout,
TimeUnit unit)
MessageStreamtrue or until the given timeout expires, returning
false.
To check if the stream has messages available now, pass a zero timeout.
hasNextAvailable in interface MessageStream<TrackedEventMessage<?>>timeout - the maximum number of time units to wait for messages to become availableunit - the time unit for the timeoutpublic TrackedEventMessage<?> nextAvailable()
MessageStreamMessageStream.hasNextAvailable()
with or without a timeout to check if the stream has available messages before calling this method.nextAvailable in interface MessageStream<TrackedEventMessage<?>>public void close()
close in interface AutoCloseableclose in interface MessageStream<TrackedEventMessage<?>>Copyright © 2010–2018. All rights reserved.