public abstract class AbstractLogManager extends Object implements LogManager
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,CloseableLogAppender> |
appenders |
protected Set<LogTailer> |
tailers |
protected Map<LogPartitionGroup,LogTailer> |
tailersAssignments |
| Constructor and Description |
|---|
AbstractLogManager() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkInvalidAssignment(String group,
LogPartition partition) |
void |
close() |
protected abstract void |
create(String name,
int size) |
protected abstract <M extends Externalizable> |
createAppender(String name) |
boolean |
createIfNotExists(String name,
int size)
Creates a new Log with
size partitions if the Log does not exists. |
<M extends Externalizable> |
createTailer(String group,
Collection<LogPartition> partitions)
Create a tailer for a consumer
group and assign multiple partitions. |
boolean |
delete(String name)
Try to delete a Log.
|
protected abstract <M extends Externalizable> |
doCreateTailer(Collection<LogPartition> partitions,
String group) |
protected abstract <M extends Externalizable> |
doSubscribe(String group,
Collection<String> names,
RebalanceListener listener) |
<M extends Externalizable> |
getAppender(String name)
Get an appender for the Log named
name. |
<M extends Externalizable> |
getLatencyPerPartition(String name,
String group,
Function<M,Long> timestampExtractor,
Function<M,String> keyExtractor)
Returns the lag with latency.
|
<M extends Externalizable> |
subscribe(String group,
Collection<String> names,
RebalanceListener listener)
Create a tailer for a consumer
group and subscribe to multiple Logs. |
boolean |
supportSubscribe()
Returns
true if the Log LogManager.subscribe(java.lang.String, java.util.Collection<java.lang.String>, org.nuxeo.lib.stream.log.RebalanceListener) method is supported. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTailer, createTailer, exists, getLag, getLagPerPartition, getLatency, listAll, listConsumerGroupsprotected final Map<String,CloseableLogAppender> appenders
protected final Map<LogPartitionGroup,LogTailer> tailersAssignments
public AbstractLogManager()
protected abstract <M extends Externalizable> CloseableLogAppender<M> createAppender(String name)
protected abstract <M extends Externalizable> LogTailer<M> doCreateTailer(Collection<LogPartition> partitions, String group)
protected abstract <M extends Externalizable> LogTailer<M> doSubscribe(String group, Collection<String> names, RebalanceListener listener)
public boolean createIfNotExists(String name, int size)
LogManagersize partitions if the Log does not exists. Returns true it the Log has been
created.createIfNotExists in interface LogManagerpublic boolean delete(String name)
LogManagerdelete in interface LogManagerpublic <M extends Externalizable> LogTailer<M> createTailer(String group, Collection<LogPartition> partitions)
LogManagergroup and assign multiple partitions. Note that partitions
can be from different Logs. A tailer is NOT thread safe.createTailer in interface LogManagerpublic boolean supportSubscribe()
LogManagertrue if the Log LogManager.subscribe(java.lang.String, java.util.Collection<java.lang.String>, org.nuxeo.lib.stream.log.RebalanceListener) method is supported.supportSubscribe in interface LogManagerpublic <M extends Externalizable> LogTailer<M> subscribe(String group, Collection<String> names, RebalanceListener listener)
LogManagergroup and subscribe to multiple Logs. The partitions assignment is done
dynamically depending on the number of subscribers. The partitions can change during tailers life, this is called
a rebalancing. A listener can be used to be notified on assignment changes.
A tailer is NOT thread safe.
You should not mix LogManager.createTailer(java.lang.String, java.util.Collection<org.nuxeo.lib.stream.log.LogPartition>) and subscribe usage using the same group.subscribe in interface LogManagerprotected void checkInvalidAssignment(String group, LogPartition partition)
public <M extends Externalizable> LogAppender<M> getAppender(String name)
LogManagername. An appender is thread safe.getAppender in interface LogManagerpublic <M extends Externalizable> List<Latency> getLatencyPerPartition(String name, String group, Function<M,Long> timestampExtractor, Function<M,String> keyExtractor)
LogManagerLogManager.getLagPerPartition(String, String).
getLatencyPerPartition in interface LogManagerpublic void close()
close in interface AutoCloseableclose in interface LogManagerCopyright © 2018 Nuxeo. All rights reserved.