Package org.nuxeo.lib.stream.log
Interface LogManager
- All Superinterfaces:
- AutoCloseable
- All Known Implementing Classes:
- AbstractLogManager,- KafkaLogManager,- MemLogManager,- UnifiedLogManager
Manage Log and give access to Appenders and Tailers. Closing the LogManager will also close all its appenders and
 tailers.
- Since:
- 9.3
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()default booleancreateIfNotExists(String name, int size) Deprecated.booleancreateIfNotExists(Name name, int size) Creates a new Log withsizepartitions if the Log does not exists.default <M extends Externalizable>
 LogTailer<M>createTailer(String group, String name) Deprecated.since 11.1 usecreateTailer(Name, Name)(Name)} insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(String group, String name, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, Name, Codec)insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(String group, Collection<LogPartition> partitions) Deprecated.since 11.1 use(Name)insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(String group, Collection<LogPartition> partitions, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, Name, Codec)(Name)} insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(String group, LogPartition partition) Deprecated.since 11.1 use(Name)insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(String group, LogPartition partition, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, LogPartition, Codec)insteaddefault <M extends Externalizable>
 LogTailer<M>createTailer(Name group, Collection<LogPartition> partitions) Creates a tailer for a consumergroupand assign multiplepartitions.<M extends Externalizable>
 LogTailer<M>createTailer(Name group, Collection<LogPartition> partitions, Codec<M> codec) Creates a tailer for a consumergroupand assign multiplepartitions.default <M extends Externalizable>
 LogTailer<M>createTailer(Name group, LogPartition partition) Creates a tailer for a consumergroupand assign a singlepartition.default <M extends Externalizable>
 LogTailer<M>createTailer(Name group, LogPartition partition, Codec<M> codec) Creates a tailer for a consumergroupand assign a singlepartition.default <M extends Externalizable>
 LogTailer<M>createTailer(Name group, Name name) Creates a tailer for a consumergroupand assign allpartitionsof the Log.default <M extends Externalizable>
 LogTailer<M>createTailer(Name group, Name name, Codec<M> codec) Creates a tailer for a consumergroupand assigns allpartitionsof the Log.default booleanDeprecated.since 11.1 usedelete(Name)insteadbooleanTries to delete a Log.default voidRemove all existing consumers and their committed positions.default voiddeleteRecords(Name name) Delete all records of a stream by moving the first offsets to end of each partition.default booleanDeprecated.since 11.1 useexists(Name)insteadbooleanReturnstrueif a Log with thisnameexists.default <M extends Externalizable>
 LogAppender<M>getAppender(String name) Deprecated.since 11.1 usegetAppender(Name)insteaddefault <M extends Externalizable>
 LogAppender<M>getAppender(String name, Codec<M> codec) Deprecated.since 11.1 usegetAppender(Name, Codec)insteaddefault <M extends Externalizable>
 LogAppender<M>getAppender(Name name) Gets an appender for the Log namedname, uses an already defined codec or the legacy encoding to encode records.<M extends Externalizable>
 LogAppender<M>getAppender(Name name, Codec<M> codec) Gets an appender for the Log namedname, usescodecto encode records.default LogLagDeprecated.since 11.1 usegetLag(Name, Name)insteaddefault LogLagReturns the lag between consumergroupand producers for a Log.getLagPerPartition(String name, String group) Deprecated.since 11.1 usegetLagPerPartition(Name, Name)insteadgetLagPerPartition(Name name, Name group) Returns the lag between consumergroupand the producers for each partition.default <M extends Externalizable>
 LatencygetLatency(String name, String group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Deprecated.since 11.1 usegetLatencyPerPartition(Name, Name, Codec, Function, Function)insteaddefault <M extends Externalizable>
 LatencygetLatency(Name name, Name group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Returns the latency between consumergroupand producers for a Log.default <M extends Externalizable>
 List<Latency>getLatencyPerPartition(String name, String group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Deprecated.since 11.1 usegetLatencyPerPartition(Name, Name, Codec, Function, Function)instead<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.listAll()Deprecated.since 11.1 uselistAllNames()insteadReturns all the Log names.listConsumerGroups(String name) Deprecated.since 11.1 uselistConsumerGroups(Name)insteadlistConsumerGroups(Name name) List the consumer groups for a Log.default intDeprecated.since 11.1 usesize(Name)insteadintReturns the number of partition of a Log.default <M extends Externalizable>
 LogTailer<M>subscribe(String group, Collection<String> names, RebalanceListener listener) Deprecated.since 11.1 usesubscribe(Name, Collection, RebalanceListener)insteaddefault <M extends Externalizable>
 LogTailer<M>subscribe(String group, Collection<String> names, RebalanceListener listener, Codec<M> codec) Deprecated.since 11.1 usesubscribe(Name, Collection, RebalanceListener, Codec)insteaddefault <M extends Externalizable>
 LogTailer<M>subscribe(Name group, Collection<Name> names, RebalanceListener listener) <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.booleanDeprecated.since 2021.34 usesupportSubscribe(Name)insteadbooleansupportSubscribe(Name stream) Returnstrueif thesubscribe(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 for the specific Log.
- 
Method Details- 
existsReturnstrueif a Log with thisnameexists.- Since:
- 11.1
 
- 
existsDeprecated.since 11.1 useexists(Name)instead
- 
createIfNotExistsCreates a new Log withsizepartitions if the Log does not exists. Returns true it the Log has been created.- Since:
- 11.1
 
- 
createIfNotExistsDeprecated.since 11.1 usecreateIfNotExists(Name, int)instead
- 
deleteTries to delete a Log. Returns true if successfully deleted, might not be possible depending on the implementation.- Since:
- 11.1
 
- 
deleteDeprecated.since 11.1 usedelete(Name)instead
- 
sizeReturns the number of partition of a Log.- Since:
- 11.1
 
- 
sizeDeprecated.since 11.1 usesize(Name)insteadReturns the number of partition of a Log.- Since:
- 10.2
 
- 
getAppenderGets an appender for the Log namedname, usescodecto encode records. An appender is thread safe.- Since:
- 10.2
 
- 
getAppender@Deprecated(since="11.1") default <M extends Externalizable> LogAppender<M> getAppender(String name, Codec<M> codec) Deprecated.since 11.1 usegetAppender(Name, Codec)instead
- 
getAppenderGets an appender for the Log namedname, uses an already defined codec or the legacy encoding to encode records. An appender is thread safe.- Since:
- 11.1
 
- 
getAppender@Deprecated(since="11.1") default <M extends Externalizable> LogAppender<M> getAppender(String name) Deprecated.since 11.1 usegetAppender(Name)insteadGets an appender for the Log namedname, uses an already defined codec or the legacy encoding to encode records. An appender is thread safe.- Since:
- 10.2
 
- 
createTailer<M extends Externalizable> LogTailer<M> createTailer(Name group, Collection<LogPartition> partitions, Codec<M> codec) Creates a tailer for a consumergroupand assign multiplepartitions. Usescodecto decode records. Note thatpartitionscan be from different Logs. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, Collection<LogPartition> partitions, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, Name, Codec)(Name)} insteadCreates a tailer for a consumergroupand assign multiplepartitions. Usescodecto decode records. Note thatpartitionscan be from different Logs. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
createTailerdefault <M extends Externalizable> LogTailer<M> createTailer(Name group, Collection<LogPartition> partitions) Creates a tailer for a consumergroupand assign multiplepartitions. Note thatpartitionscan be from different Logs. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, Collection<LogPartition> partitions) Deprecated.since 11.1 use(Name)insteadCreates a tailer for a consumergroupand assign multiplepartitions. Note thatpartitionscan be from different Logs. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
createTailerCreates a tailer for a consumergroupand assign a singlepartition. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, LogPartition partition) Deprecated.since 11.1 use(Name)insteadCreates a tailer for a consumergroupand assign a singlepartition. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
createTailerCreates a tailer for a consumergroupand assign allpartitionsof the Log. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, String name) Deprecated.since 11.1 usecreateTailer(Name, Name)(Name)} insteadCreates a tailer for a consumergroupand assign allpartitionsof the Log. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
createTailerdefault <M extends Externalizable> LogTailer<M> createTailer(Name group, LogPartition partition, Codec<M> codec) Creates a tailer for a consumergroupand assign a singlepartition. Use an explicit codec to decode records. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, LogPartition partition, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, LogPartition, Codec)insteadCreates a tailer for a consumergroupand assign a singlepartition. Use an explicit codec to decode records. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
createTailerCreates a tailer for a consumergroupand assigns allpartitionsof the Log. Usescodecto decode records. A tailer is NOT thread safe.- Since:
- 11.1
 
- 
createTailer@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> createTailer(String group, String name, Codec<M> codec) Deprecated.since 11.1 usecreateTailer(Name, Name, Codec)insteadCreates a tailer for a consumergroupand assigns allpartitionsof the Log. Usescodecto decode records. A tailer is NOT thread safe.- Since:
- 10.2
 
- 
supportSubscribeboolean supportSubscribe()Deprecated.since 2021.34 usesupportSubscribe(Name)insteadReturnstrueif the Logsubscribe(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. Now deprecated because some implementations support subscribe only on specific Log names.
- 
supportSubscribeReturnstrueif thesubscribe(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 for the specific Log.- Since:
- 2021.34
 
- 
subscribe<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. 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.- Since:
- 11.1
- Implementation Requirements:
- You should not mix createTailer(org.nuxeo.lib.stream.log.Name, java.util.Collection<org.nuxeo.lib.stream.log.LogPartition>, org.nuxeo.lib.stream.codec.Codec<M>)andsubscribeusage using the samegroup.
- Implementation Note:
- A tailer is NOT thread safe.
 
- 
subscribe@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> subscribe(String group, Collection<String> names, RebalanceListener listener, Codec<M> codec) Deprecated.since 11.1 usesubscribe(Name, Collection, RebalanceListener, Codec)insteadCreates 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.- Since:
- 10.2
- Implementation Requirements:
- You should not mix createTailer(org.nuxeo.lib.stream.log.Name, java.util.Collection<org.nuxeo.lib.stream.log.LogPartition>, org.nuxeo.lib.stream.codec.Codec<M>)andsubscribeusage using the samegroup.
- Implementation Note:
- A tailer is NOT thread safe.
 
- 
subscribedefault <M extends Externalizable> LogTailer<M> subscribe(Name group, Collection<Name> names, RebalanceListener listener) 
- 
subscribe@Deprecated(since="11.1") default <M extends Externalizable> LogTailer<M> subscribe(String group, Collection<String> names, RebalanceListener listener) Deprecated.since 11.1 usesubscribe(Name, Collection, RebalanceListener)instead- Since:
- 10.2
 
- 
getLagPerPartitionReturns the lag between consumergroupand the producers for each partition. The result list is ordered, for instance index 0 is lag for partition 0.- Since:
- 11.1
 
- 
getLagPerPartitionDeprecated.since 11.1 usegetLagPerPartition(Name, Name)insteadReturns the lag between consumergroupand the producers for each partition. The result list is ordered, for instance index 0 is lag for partition 0.- Since:
- 10.2
 
- 
getLagReturns the lag between consumergroupand producers for a Log.- Since:
- 11.1
 
- 
getLagDeprecated.since 11.1 usegetLag(Name, Name)insteadReturns the lag between consumergroupand producers for a Log.- Since:
- 10.2
 
- 
getLatencyPerPartition<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. Timestamps used to compute the latencies are extracted from the records. This requires to read one record per partition so it costs more thangetLagPerPartition(Name, Name).Two functions need to be provided to extract the timestamp and a key from a record. - Since:
- 11.1
 
- 
getLatencyPerPartition@Deprecated(since="11.1") default <M extends Externalizable> List<Latency> getLatencyPerPartition(String name, String group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Deprecated.since 11.1 usegetLatencyPerPartition(Name, Name, Codec, Function, Function)insteadReturns 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 thangetLagPerPartition(Name, Name).Two functions need to be provided to extract the timestamp and a key from a record. - Since:
- 10.2
 
- 
getLatencydefault <M extends Externalizable> Latency getLatency(Name name, Name group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Returns the latency between consumergroupand producers for a Log.- Since:
- 11.1
 
- 
getLatency@Deprecated(since="11.1") default <M extends Externalizable> Latency getLatency(String name, String group, Codec<M> codec, Function<M, Long> timestampExtractor, Function<M, String> keyExtractor) Deprecated.since 11.1 usegetLatencyPerPartition(Name, Name, Codec, Function, Function)insteadReturns the latency between consumergroupand producers for a Log.- Since:
- 10.2
 
- 
listAllDeprecated.since 11.1 uselistAllNames()insteadReturns all the Log names.
- 
listAllNamesReturns all the Log names.- Since:
- 11.1
 
- 
listConsumerGroupsList the consumer groups for a Log.- Since:
- 11.1
- Implementation Note:
- Note that for Kafka it returns only consumers that use the subscribe API.
 
- 
listConsumerGroupsDeprecated.since 11.1 uselistConsumerGroups(Name)insteadList the consumer groups for a Log.- Since:
- 10.2
- Implementation Note:
- Note that for Kafka it returns only consumers that use the subscribe API.
 
- 
closevoid close()- Specified by:
- closein interface- AutoCloseable
 
- 
deleteRecordsDelete all records of a stream by moving the first offsets to end of each partition. Exposed for testing purpose, might not be implemented on all implementation.- Since:
- 2021.43
 
- 
deleteConsumersdefault void deleteConsumers()Remove all existing consumers and their committed positions. Exposed for testing purpose, might not be implemented by all implementation.- Since:
- 2021.43
 
 
- 
createIfNotExists(Name, int)instead