public class ChronicleLogTailer<M extends Externalizable> extends Object implements LogTailer<M>
Modifier and Type | Field and Description |
---|---|
protected String |
basePath |
protected boolean |
closed |
protected Codec<M> |
codec |
protected net.openhft.chronicle.queue.ExcerptTailer |
cqTailer |
protected LogPartitionGroup |
id |
protected ChronicleLogOffsetTracker |
offsetTracker |
protected LogPartition |
partition |
protected static long |
POLL_INTERVAL_MS |
protected static Set<LogPartitionGroup> |
tailersId |
Constructor and Description |
---|
ChronicleLogTailer(Codec<M> codec,
String basePath,
net.openhft.chronicle.queue.ExcerptTailer cqTailer,
LogPartition partition,
String group,
ChronicleRetentionDuration retention) |
Modifier and Type | Method and Description |
---|---|
Collection<LogPartition> |
assignments()
Returns the list of Log name, partitions tuples currently assigned to this tailer.
|
void |
close() |
boolean |
closed()
Returns
true if the tailer has been closed. |
void |
commit()
Commit current positions for all partitions (last message offset returned by read).
|
LogOffset |
commit(LogPartition partition)
Commit current position for the partition.
|
Codec<M> |
getCodec()
Returns the codec used to read the records.
|
String |
group()
Returns the consumer group.
|
LogOffset |
offsetForTimestamp(LogPartition partition,
long timestamp)
Look up the offset for the given partition by timestamp.
|
protected LogRecord<M> |
read() |
LogRecord<M> |
read(Duration timeout)
Read a message from assigned partitions within the timeout.
|
protected void |
registerTailer() |
void |
reset()
Reset all committed positions for this group, next read will be done from beginning.
|
void |
reset(LogPartition partition)
Reset the committed position for this group on this partition, next read for this partition will be done from the
beginning.
|
void |
seek(LogOffset offset)
Set the current position for a single partition.
|
void |
toEnd()
Set the current positions to the end of all partitions.
|
void |
toLastCommitted()
Set the current positions to previously committed positions.
|
void |
toStart()
Set the current positions to the beginning of all partitions.
|
String |
toString() |
protected void |
unregisterTailer() |
protected static final long POLL_INTERVAL_MS
protected static final Set<LogPartitionGroup> tailersId
protected final net.openhft.chronicle.queue.ExcerptTailer cqTailer
protected final ChronicleLogOffsetTracker offsetTracker
protected final LogPartitionGroup id
protected final LogPartition partition
protected final Codec<M extends Externalizable> codec
protected volatile boolean closed
public ChronicleLogTailer(Codec<M> codec, String basePath, net.openhft.chronicle.queue.ExcerptTailer cqTailer, LogPartition partition, String group, ChronicleRetentionDuration retention)
protected void registerTailer()
protected void unregisterTailer()
public LogRecord<M> read(Duration timeout) throws InterruptedException
LogTailer
read
in interface LogTailer<M extends Externalizable>
InterruptedException
public LogOffset commit(LogPartition partition)
LogTailer
commit
in interface LogTailer<M extends Externalizable>
public void commit()
LogTailer
commit
in interface LogTailer<M extends Externalizable>
public void toEnd()
LogTailer
toEnd
in interface LogTailer<M extends Externalizable>
public void toStart()
LogTailer
toStart
in interface LogTailer<M extends Externalizable>
public void toLastCommitted()
LogTailer
toLastCommitted
in interface LogTailer<M extends Externalizable>
public void seek(LogOffset offset)
LogTailer
seek
in interface LogTailer<M extends Externalizable>
public void reset()
LogTailer
reset
in interface LogTailer<M extends Externalizable>
public void reset(LogPartition partition)
LogTailer
reset
in interface LogTailer<M extends Externalizable>
public LogOffset offsetForTimestamp(LogPartition partition, long timestamp)
LogTailer
offsetForTimestamp
in interface LogTailer<M extends Externalizable>
public Collection<LogPartition> assignments()
LogTailer
LogManager.subscribe(java.lang.String, java.util.Collection<java.lang.String>, org.nuxeo.lib.stream.log.RebalanceListener, org.nuxeo.lib.stream.codec.Codec<M>)
.assignments
in interface LogTailer<M extends Externalizable>
public String group()
LogTailer
group
in interface LogTailer<M extends Externalizable>
public void close()
close
in interface AutoCloseable
close
in interface LogTailer<M extends Externalizable>
public boolean closed()
LogTailer
true
if the tailer has been closed.closed
in interface LogTailer<M extends Externalizable>
public Codec<M> getCodec()
LogTailer
getCodec
in interface LogTailer<M extends Externalizable>
Copyright © 2018 Nuxeo. All rights reserved.