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)  | 
protected void | 
checkInvalidCodec(LogPartition partition,
                 Codec codec)  | 
void | 
close()  | 
protected abstract void | 
create(String name,
      int size)  | 
protected abstract <M extends Externalizable> | 
createAppender(String name,
              Codec<M> codec)  | 
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,
            Codec<M> codec)
Creates a tailer for a consumer  
group and assign multiple partitions. | 
boolean | 
delete(String name)
Tries to delete a Log. 
 | 
protected abstract <M extends Externalizable> | 
doCreateTailer(Collection<LogPartition> partitions,
              String group,
              Codec<M> codec)  | 
protected abstract <M extends Externalizable> | 
doSubscribe(String group,
           Collection<String> names,
           RebalanceListener listener,
           Codec<M> codec)  | 
<M extends Externalizable> | 
getAppender(String name,
           Codec<M> codec)
Gets an appender for the Log named  
name, uses codec to encode records. | 
<M extends Externalizable> | 
getLatencyPerPartition(String name,
                      String group,
                      Codec<M> codec,
                      Function<M,Long> timestampExtractor,
                      Function<M,String> keyExtractor)
Returns the lag with latency. 
 | 
protected abstract int | 
getSize(String name)  | 
protected <M extends Externalizable> | 
guessCodec(Collection<LogPartition> partitions)  | 
protected boolean | 
sameCodec(Codec codec1,
         Codec codec2)  | 
int | 
size(String name)
Returns the number of partition of a Log. 
 | 
<M extends Externalizable> | 
subscribe(String group,
         Collection<String> names,
         RebalanceListener listener,
         Codec<M> codec)
Creates 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, org.nuxeo.lib.stream.codec.Codec<M>) method is supported. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTailer, createTailer, createTailer, createTailer, createTailer, exists, getAppender, getLag, getLagPerPartition, getLatency, getLatency, getLatencyPerPartition, listAll, listConsumerGroups, subscribeprotected final Map<String,CloseableLogAppender> appenders
protected final Map<LogPartitionGroup,LogTailer> tailersAssignments
public AbstractLogManager()
protected abstract <M extends Externalizable> CloseableLogAppender<M> createAppender(String name, Codec<M> codec)
protected abstract <M extends Externalizable> LogTailer<M> doCreateTailer(Collection<LogPartition> partitions, String group, Codec<M> codec)
protected abstract <M extends Externalizable> LogTailer<M> doSubscribe(String group, Collection<String> names, RebalanceListener listener, Codec<M> codec)
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 int size(String name)
LogManagersize in interface LogManagerpublic <M extends Externalizable> LogTailer<M> createTailer(String group, Collection<LogPartition> partitions, Codec<M> codec)
LogManagergroup and assign multiple partitions. Uses codec to
 decode records. Note that partitions can be from different Logs. A tailer is NOT thread safe.createTailer in interface LogManagerprotected <M extends Externalizable> Codec<M> guessCodec(Collection<LogPartition> partitions)
public boolean supportSubscribe()
LogManagertrue if the Log LogManager.subscribe(java.lang.String, java.util.Collection<java.lang.String>, org.nuxeo.lib.stream.log.RebalanceListener, org.nuxeo.lib.stream.codec.Codec<M>) method is supported.supportSubscribe in interface LogManagerpublic <M extends Externalizable> LogTailer<M> subscribe(String group, Collection<String> names, RebalanceListener listener, Codec<M> codec)
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. Uses codec to decode records.
 
 A tailer is NOT thread safe.
 
 You should not mix LogManager.createTailer(java.lang.String, java.util.Collection<org.nuxeo.lib.stream.log.LogPartition>, org.nuxeo.lib.stream.codec.Codec<M>) and subscribe usage using the same group.subscribe in interface LogManagerprotected void checkInvalidAssignment(String group, LogPartition partition)
protected void checkInvalidCodec(LogPartition partition, Codec codec)
public <M extends Externalizable> LogAppender<M> getAppender(String name, Codec<M> codec)
LogManagername, uses codec to encode records. An appender is thread
 safe.getAppender in interface LogManagerpublic <M extends Externalizable> List<Latency> getLatencyPerPartition(String name, String group, Codec<M> codec, 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 © 2019 Nuxeo. All rights reserved.