Package org.nuxeo.lib.stream.log
Interface LogManager
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractLogManager
,ChronicleLogManager
,KafkaLogManager
,UnifiedLogManager
public interface LogManager extends AutoCloseable
Manage Log and give access to Appenders and Tailers. Closing the LogManager will also close all its appenders and tailers.- Since:
- 9.3
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
close()
default boolean
createIfNotExists(String name, int size)
Deprecated.since 11.1 usecreateIfNotExists(Name, int)
insteadboolean
createIfNotExists(Name name, int size)
Creates a new Log withsize
partitions 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 consumergroup
and assign multiplepartitions
.<M extends Externalizable>
LogTailer<M>createTailer(Name group, Collection<LogPartition> partitions, Codec<M> codec)
Creates a tailer for a consumergroup
and assign multiplepartitions
.default <M extends Externalizable>
LogTailer<M>createTailer(Name group, LogPartition partition)
Creates a tailer for a consumergroup
and assign a singlepartition
.default <M extends Externalizable>
LogTailer<M>createTailer(Name group, LogPartition partition, Codec<M> codec)
Creates a tailer for a consumergroup
and assign a singlepartition
.default <M extends Externalizable>
LogTailer<M>createTailer(Name group, Name name)
Creates a tailer for a consumergroup
and assign allpartitions
of the Log.default <M extends Externalizable>
LogTailer<M>createTailer(Name group, Name name, Codec<M> codec)
Creates a tailer for a consumergroup
and assigns allpartitions
of the Log.default boolean
delete(String name)
Deprecated.since 11.1 usedelete(Name)
insteadboolean
delete(Name name)
Tries to delete a Log.default void
deleteConsumers()
Remove all existing consumers and their committed positions.default void
deleteRecords(Name name)
Delete all records of a stream by moving the first offsets to end of each partition.default boolean
exists(String name)
Deprecated.since 11.1 useexists(Name)
insteadboolean
exists(Name name)
Returnstrue
if a Log with thisname
exists.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
, usescodec
to encode records.default LogLag
getLag(String name, String group)
Deprecated.since 11.1 usegetLag(Name, Name)
insteaddefault LogLag
getLag(Name name, Name group)
Returns the lag between consumergroup
and producers for a Log.default List<LogLag>
getLagPerPartition(String name, String group)
Deprecated.since 11.1 usegetLagPerPartition(Name, Name)
insteadList<LogLag>
getLagPerPartition(Name name, Name group)
Returns the lag between consumergroup
and 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 consumergroup
and 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.default List<String>
listAll()
Deprecated.since 11.1 uselistAllNames()
insteadList<Name>
listAllNames()
Returns all the Log names.default List<String>
listConsumerGroups(String name)
Deprecated.since 11.1 uselistConsumerGroups(Name)
insteadList<Name>
listConsumerGroups(Name name)
List the consumer groups for a Log.default int
size(String name)
Deprecated.since 11.1 usesize(Name)
insteadint
size(Name name)
Returns 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 consumergroup
and subscribe to multiple Logs.boolean
supportSubscribe()
Deprecated.since 2021.34 usesupportSubscribe(Name)
insteadboolean
supportSubscribe(Name stream)
Returnstrue
if 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 Detail
-
exists
boolean exists(Name name)
Returnstrue
if a Log with thisname
exists.- Since:
- 11.1
-
exists
@Deprecated(since="11.1") default boolean exists(String name)
Deprecated.since 11.1 useexists(Name)
instead
-
createIfNotExists
boolean createIfNotExists(Name name, int size)
Creates a new Log withsize
partitions if the Log does not exists. Returns true it the Log has been created.- Since:
- 11.1
-
createIfNotExists
@Deprecated(since="11.1") default boolean createIfNotExists(String name, int size)
Deprecated.since 11.1 usecreateIfNotExists(Name, int)
instead
-
delete
boolean delete(Name name)
Tries to delete a Log. Returns true if successfully deleted, might not be possible depending on the implementation.- Since:
- 11.1
-
delete
@Deprecated(since="11.1") default boolean delete(String name)
Deprecated.since 11.1 usedelete(Name)
instead
-
size
int size(Name name)
Returns the number of partition of a Log.- Since:
- 11.1
-
size
@Deprecated(since="11.1") default int size(String name)
Deprecated.since 11.1 usesize(Name)
insteadReturns the number of partition of a Log.- Since:
- 10.2
-
getAppender
<M extends Externalizable> LogAppender<M> getAppender(Name name, Codec<M> codec)
Gets an appender for the Log namedname
, usescodec
to 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
-
getAppender
default <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. 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 consumergroup
and assign multiplepartitions
. Usescodec
to decode records. Note thatpartitions
can 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 consumergroup
and assign multiplepartitions
. Usescodec
to decode records. Note thatpartitions
can be from different Logs. A tailer is NOT thread safe.- Since:
- 10.2
-
createTailer
default <M extends Externalizable> LogTailer<M> createTailer(Name group, Collection<LogPartition> partitions)
Creates a tailer for a consumergroup
and assign multiplepartitions
. Note thatpartitions
can 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 consumergroup
and assign multiplepartitions
. Note thatpartitions
can be from different Logs. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
-
createTailer
default <M extends Externalizable> LogTailer<M> createTailer(Name group, LogPartition partition)
Creates a tailer for a consumergroup
and 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 consumergroup
and assign a singlepartition
. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
-
createTailer
default <M extends Externalizable> LogTailer<M> createTailer(Name group, Name name)
Creates a tailer for a consumergroup
and assign allpartitions
of 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 consumergroup
and assign allpartitions
of the Log. Reads records using the legacy decoder. A tailer is NOT thread safe.- Since:
- 10.2
-
createTailer
default <M extends Externalizable> LogTailer<M> createTailer(Name group, LogPartition partition, Codec<M> codec)
Creates a tailer for a consumergroup
and 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 consumergroup
and assign a singlepartition
. Use an explicit codec to decode records. A tailer is NOT thread safe.- Since:
- 10.2
-
createTailer
default <M extends Externalizable> LogTailer<M> createTailer(Name group, Name name, Codec<M> codec)
Creates a tailer for a consumergroup
and assigns allpartitions
of the Log. Usescodec
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, String name, Codec<M> codec)
Deprecated.since 11.1 usecreateTailer(Name, Name, Codec)
insteadCreates a tailer for a consumergroup
and assigns allpartitions
of the Log. Usescodec
to decode records. A tailer is NOT thread safe.- Since:
- 10.2
-
supportSubscribe
boolean supportSubscribe()
Deprecated.since 2021.34 usesupportSubscribe(Name)
insteadReturnstrue
if 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.
-
supportSubscribe
boolean supportSubscribe(Name stream)
Returnstrue
if 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 consumergroup
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. Usescodec
to 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>)
andsubscribe
usage 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 consumergroup
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. Usescodec
to 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>)
andsubscribe
usage using the samegroup
. - Implementation Note:
- A tailer is NOT thread safe.
-
subscribe
default <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
-
getLagPerPartition
List<LogLag> getLagPerPartition(Name name, Name group)
Returns the lag between consumergroup
and the producers for each partition. The result list is ordered, for instance index 0 is lag for partition 0.- Since:
- 11.1
-
getLagPerPartition
@Deprecated(since="11.1") default List<LogLag> getLagPerPartition(String name, String group)
Deprecated.since 11.1 usegetLagPerPartition(Name, Name)
insteadReturns the lag between consumergroup
and the producers for each partition. The result list is ordered, for instance index 0 is lag for partition 0.- Since:
- 10.2
-
getLag
default LogLag getLag(Name name, Name group)
Returns the lag between consumergroup
and producers for a Log.- Since:
- 11.1
-
getLag
@Deprecated(since="11.1") default LogLag getLag(String name, String group)
Deprecated.since 11.1 usegetLag(Name, Name)
insteadReturns the lag between consumergroup
and 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
-
getLatency
default <M extends Externalizable> Latency getLatency(Name name, Name group, Codec<M> codec, Function<M,Long> timestampExtractor, Function<M,String> keyExtractor)
Returns the latency between consumergroup
and 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 consumergroup
and producers for a Log.- Since:
- 10.2
-
listAll
@Deprecated(since="11.1") default List<String> listAll()
Deprecated.since 11.1 uselistAllNames()
insteadReturns all the Log names.
-
listConsumerGroups
List<Name> listConsumerGroups(Name name)
List the consumer groups for a Log.- Since:
- 11.1
- Implementation Note:
- Note that for Kafka it returns only consumers that use the subscribe API.
-
listConsumerGroups
@Deprecated(since="11.1") default List<String> listConsumerGroups(String name)
Deprecated.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.
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
-
deleteRecords
default void deleteRecords(Name name)
Delete 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
-
deleteConsumers
default void deleteConsumers()
Remove all existing consumers and their committed positions. Exposed for testing purpose, might not be implemented by all implementation.- Since:
- 2021.43
-
-