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, wait
createTailer, createTailer, exists, getLag, getLagPerPartition, getLatency, listAll, listConsumerGroups
protected 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)
LogManager
size
partitions if the Log does not exists. Returns true it the Log has been
created.createIfNotExists
in interface LogManager
public boolean delete(String name)
LogManager
delete
in interface LogManager
public <M extends Externalizable> LogTailer<M> createTailer(String group, Collection<LogPartition> partitions)
LogManager
group
and assign multiple partitions
. Note that partitions
can be from different Logs. A tailer is NOT thread safe.createTailer
in interface LogManager
public boolean supportSubscribe()
LogManager
true
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 LogManager
public <M extends Externalizable> LogTailer<M> subscribe(String group, Collection<String> names, RebalanceListener listener)
LogManager
group
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 LogManager
protected void checkInvalidAssignment(String group, LogPartition partition)
public <M extends Externalizable> LogAppender<M> getAppender(String name)
LogManager
name
. An appender is thread safe.getAppender
in interface LogManager
public <M extends Externalizable> List<Latency> getLatencyPerPartition(String name, String group, Function<M,Long> timestampExtractor, Function<M,String> keyExtractor)
LogManager
LogManager.getLagPerPartition(String, String)
.
getLatencyPerPartition
in interface LogManager
public void close()
close
in interface AutoCloseable
close
in interface LogManager
Copyright © 2018 Nuxeo. All rights reserved.