public class EventBuffer extends Object implements TrackingEventStream
This class is intended for internal use. Be cautious.
Constructor and Description |
---|
EventBuffer(io.axoniq.axonserver.connector.event.EventStream delegate,
EventUpcaster upcasterChain,
Serializer serializer,
boolean disableEventBlacklisting)
Initializes an Event Buffer, passing messages through given
upcasterChain and deserializing events using
given serializer . |
Modifier and Type | Method and Description |
---|---|
void |
blacklist(TrackedEventMessage<?> trackedEventMessage)
Report the stream that a specific message was ignored by the consumer.
|
void |
close() |
boolean |
hasNextAvailable(int timeout,
TimeUnit timeUnit)
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, wait
asStream, hasNextAvailable
public EventBuffer(io.axoniq.axonserver.connector.event.EventStream delegate, EventUpcaster upcasterChain, Serializer serializer, boolean disableEventBlacklisting)
upcasterChain
and deserializing events using
given serializer
.delegate
- the EventStream
to delegate operations toupcasterChain
- the upcasterChain to translate serialized representations before deserializingserializer
- the serializer capable of deserializing incoming messagesdisableEventBlacklisting
- specifying whether events should or should not be included in the bufferpublic void blacklist(TrackedEventMessage<?> trackedEventMessage)
This implementation removes events from the stream based on the payload type of the given message.
blacklist
in interface BlockingStream<TrackedEventMessage<?>>
trackedEventMessage
- the message containing the payload to blacklistpublic Optional<TrackedEventMessage<?>> peek()
BlockingStream
peek
in interface BlockingStream<TrackedEventMessage<?>>
public boolean hasNextAvailable(int timeout, TimeUnit timeUnit)
BlockingStream
true
or until the given timeout
expires, returning
false
.
To check if the stream has messages available now, pass a zero timeout
.
hasNextAvailable
in interface BlockingStream<TrackedEventMessage<?>>
timeout
- the maximum number of time units to wait for messages to become availabletimeUnit
- the time unit for the timeoutpublic TrackedEventMessage<?> nextAvailable()
BlockingStream
BlockingStream.hasNextAvailable()
with or without a timeout to check if the stream has available messages before calling this method.nextAvailable
in interface BlockingStream<TrackedEventMessage<?>>
public void close()
close
in interface AutoCloseable
close
in interface BlockingStream<TrackedEventMessage<?>>
Copyright © 2010–2020. All rights reserved.