Package org.nuxeo.lib.stream.log
Interface LogAppender<M extends Externalizable>
-
- All Known Subinterfaces:
CloseableLogAppender<M>
- All Known Implementing Classes:
ChronicleLogAppender
,KafkaLogAppender
public interface LogAppender<M extends Externalizable>
An appender is used to append message into a Log. Implementations must be thread safe.- Since:
- 9.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description LogOffset
append(int partition, M message)
Append a message into a partition, returnsLogOffset
position of the message.default LogOffset
append(String key, M message)
Same asappend(int, Externalizable)
, the queue is chosen using a hash of parameters "key".boolean
closed()
Returnstrue
if the appender has been closed by the manager.Codec<M>
getCodec()
Returns the codec used to write record.Name
name()
Returns the Log's name.int
size()
Returns the number of partitions in the Log.boolean
waitFor(LogOffset offset, Name group, Duration timeout)
Wait for consumer to process a message up to the offset.
-
-
-
Method Detail
-
name
Name name()
Returns the Log's name.
-
size
int size()
Returns the number of partitions in the Log.
-
append
LogOffset append(int partition, M message)
Append a message into a partition, returnsLogOffset
position of the message. This method is thread safe, a queue can be shared by multiple producers.- Parameters:
partition
- index lower thansize()
-
append
default LogOffset append(String key, M message)
Same asappend(int, Externalizable)
, the queue is chosen using a hash of parameters "key".
-
waitFor
boolean waitFor(LogOffset offset, Name group, Duration timeout) throws InterruptedException
Wait for consumer to process a message up to the offset. The message is processed if a consumer of the group commits a greater or equals offset. Returntrue
if the message has been consumed,false
in case of timeout.- Throws:
InterruptedException
-
closed
boolean closed()
Returnstrue
if the appender has been closed by the manager.
-
-