Package org.nuxeo.lib.stream.log
Class UnifiedLogManager
- java.lang.Object
- 
- org.nuxeo.lib.stream.log.UnifiedLogManager
 
- 
- All Implemented Interfaces:
- AutoCloseable,- LogManager
 
 public class UnifiedLogManager extends Object implements LogManager - Since:
- 11.1
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected List<LogConfig>configsprotected LogManagercqManagerprotected LogConfigdefaultConfigprotected LogManagerdefaultManagerprotected LogManagerkafkaManagerprotected Map<LogConfig,LogManager>managers
 - 
Constructor SummaryConstructors Constructor Description UnifiedLogManager(List<LogConfig> configs)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidcreateCQLogManager()booleancreateIfNotExists(Name name, int size)Creates a new Log withsizepartitions if the Log does not exists.protected voidcreateKafkaLogManager()<M extends Externalizable>
 LogTailer<M>createTailer(Name group, Collection<LogPartition> partitions, Codec<M> codec)Creates a tailer for a consumergroupand assign multiplepartitions.booleandelete(Name name)Tries to delete a Log.booleanexists(Name name)Returnstrueif a Log with thisnameexists.protected voidfindDefaultLogManger()<M extends Externalizable>
 LogAppender<M>getAppender(Name name, Codec<M> codec)Gets an appender for the Log namedname, usescodecto encode records.List<LogLag>getLagPerPartition(Name name, Name group)Returns the lag between consumergroupand the producers for each partition.<M extends Externalizable>
 List<Latency>getLatencyPerPartition(Name name, Name group, Codec<M> codec, Function<M,Long> timestampExtractor, Function<M,String> keyExtractor)Returns the lag with latency.protected LogManagergetManager(Name name)protected LogManagergetManager(Name name, Name group)List<Name>listAllNames()Returns all the Log names.List<Name>listConsumerGroups(Name name)List the consumer groups for a Log.intsize(Name name)Returns the number of partition of a Log.<M extends Externalizable>
 LogTailer<M>subscribe(Name group, Collection<Name> names, RebalanceListener listener, Codec<M> codec)Creates a tailer for a consumergroupand subscribe to multiple Logs.booleansupportSubscribe()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.nuxeo.lib.stream.log.LogManagercreateIfNotExists, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, createTailer, delete, exists, getAppender, getAppender, getAppender, getLag, getLag, getLagPerPartition, getLatency, getLatency, getLatencyPerPartition, listAll, listConsumerGroups, size, subscribe, subscribe, subscribe
 
- 
 
- 
- 
- 
Field Detail- 
cqManagerprotected LogManager cqManager 
 - 
kafkaManagerprotected LogManager kafkaManager 
 - 
defaultManagerprotected LogManager defaultManager 
 - 
defaultConfigprotected LogConfig defaultConfig 
 - 
managersprotected Map<LogConfig,LogManager> managers 
 
- 
 - 
Constructor Detail- 
UnifiedLogManagerpublic UnifiedLogManager(List<LogConfig> configs) 
 
- 
 - 
Method Detail- 
createCQLogManagerprotected void createCQLogManager() 
 - 
createKafkaLogManagerprotected void createKafkaLogManager() 
 - 
findDefaultLogMangerprotected void findDefaultLogManger() 
 - 
getManagerprotected LogManager getManager(Name name) 
 - 
getManagerprotected LogManager getManager(Name name, Name group) 
 - 
existspublic boolean exists(Name name) Description copied from interface:LogManagerReturnstrueif a Log with thisnameexists.- Specified by:
- existsin interface- LogManager
 
 - 
createIfNotExistspublic boolean createIfNotExists(Name name, int size) Description copied from interface:LogManagerCreates a new Log withsizepartitions if the Log does not exists. Returns true it the Log has been created.- Specified by:
- createIfNotExistsin interface- LogManager
 
 - 
deletepublic boolean delete(Name name) Description copied from interface:LogManagerTries to delete a Log. Returns true if successfully deleted, might not be possible depending on the implementation.- Specified by:
- deletein interface- LogManager
 
 - 
sizepublic int size(Name name) Description copied from interface:LogManagerReturns the number of partition of a Log.- Specified by:
- sizein interface- LogManager
 
 - 
getAppenderpublic <M extends Externalizable> LogAppender<M> getAppender(Name name, Codec<M> codec) Description copied from interface:LogManagerGets an appender for the Log namedname, usescodecto encode records. An appender is thread safe.- Specified by:
- getAppenderin interface- LogManager
 
 - 
createTailerpublic <M extends Externalizable> LogTailer<M> createTailer(Name group, Collection<LogPartition> partitions, Codec<M> codec) Description copied from interface:LogManagerCreates a tailer for a consumergroupand assign multiplepartitions. Usescodecto decode records. Note thatpartitionscan be from different Logs. A tailer is NOT thread safe.- Specified by:
- createTailerin interface- LogManager
 
 - 
supportSubscribepublic boolean supportSubscribe() Description copied from interface:LogManagerReturnstrueif the LogLogManager.subscribe(org.nuxeo.lib.stream.log.Name, java.util.Collection<org.nuxeo.lib.stream.log.Name>, org.nuxeo.lib.stream.log.RebalanceListener, org.nuxeo.lib.stream.codec.Codec<M>)method is supported.- Specified by:
- supportSubscribein interface- LogManager
 
 - 
subscribepublic <M extends Externalizable> LogTailer<M> subscribe(Name group, Collection<Name> names, RebalanceListener listener, Codec<M> codec) Description copied from interface:LogManagerCreates a tailer for a consumergroupand 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. Usescodecto decode records.- Specified by:
- subscribein interface- LogManager
 
 - 
getLagPerPartitionpublic List<LogLag> getLagPerPartition(Name name, Name group) Description copied from interface:LogManagerReturns the lag between consumergroupand the producers for each partition. The result list is ordered, for instance index 0 is lag for partition 0.- Specified by:
- getLagPerPartitionin interface- LogManager
 
 - 
getLatencyPerPartitionpublic <M extends Externalizable> List<Latency> getLatencyPerPartition(Name name, Name group, Codec<M> codec, Function<M,Long> timestampExtractor, Function<M,String> keyExtractor) Description copied from interface:LogManagerReturns the lag with latency. Timestamps used to compute the latencies are extracted from the records. This requires to read one record per partition so it costs more thanLogManager.getLagPerPartition(Name, Name).Two functions need to be provided to extract the timestamp and a key from a record. - Specified by:
- getLatencyPerPartitionin interface- LogManager
 
 - 
listAllNamespublic List<Name> listAllNames() Description copied from interface:LogManagerReturns all the Log names.- Specified by:
- listAllNamesin interface- LogManager
 
 - 
listConsumerGroupspublic List<Name> listConsumerGroups(Name name) Description copied from interface:LogManagerList the consumer groups for a Log.- Specified by:
- listConsumerGroupsin interface- LogManager
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- LogManager
 
 
- 
 
-