Package org.nuxeo.lib.stream.log.kafka
Class KafkaLogManager
- java.lang.Object
-
- org.nuxeo.lib.stream.log.internals.AbstractLogManager
-
- org.nuxeo.lib.stream.log.kafka.KafkaLogManager
-
- All Implemented Interfaces:
AutoCloseable,LogManager
public class KafkaLogManager extends AbstractLogManager
- Since:
- 9.3
-
-
Field Summary
Fields Modifier and Type Field Description protected List<KafkaLogConfig>configsprotected KafkaLogConfigdefaultConfigstatic StringDISABLE_SUBSCRIBE_PROPprotected Map<KafkaLogConfig,KafkaUtils>kUtils-
Fields inherited from class org.nuxeo.lib.stream.log.internals.AbstractLogManager
ADMIN_GROUP, appenders, tailers, tailersAssignments
-
-
Constructor Summary
Constructors Constructor Description KafkaLogManager(String prefix, Properties producerProperties, Properties consumerProperties)KafkaLogManager(List<KafkaLogConfig> kafkaConfigs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckValidPartition(LogPartition partition)voidclose()voidcreate(Name name, int size)<M extends Externalizable>
CloseableLogAppender<M>createAppender(Name name, Codec<M> codec)booleandelete(Name name)Tries to delete a Log.voiddeleteConsumers()Remove all existing consumers and their committed positions.voiddeleteRecords(Name name)Delete all records of a stream by moving the first offsets to end of each partition.protected <M extends Externalizable>
LogTailer<M>doCreateTailer(Collection<LogPartition> partitions, Name group, Codec<M> codec)protected <M extends Externalizable>
LogTailer<M>doSubscribe(Name group, Collection<Name> names, RebalanceListener listener, Codec<M> codec)booleanexists(Name name)Returnstrueif a Log with thisnameexists.protected StringfilterDisplayedProperties(Properties properties)protected KafkaLogConfigfindDefaultConfig()protected KafkaLogConfiggetConfig(Name name)protected KafkaLogConfiggetConfig(Name name, Name group)List<LogLag>getLagPerPartition(Name name, Name group)Returns the lag between consumergroupand the producers for each partition.protected intgetSize(Name name)List<Name>listAllNames()Returns all the Log names.List<Name>listConsumerGroups(Name name)List the consumer groups for a Log.booleansupportSubscribe()booleansupportSubscribe(Name stream)Returnstrueif theLogManager.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 for the specific Log.StringtoString()-
Methods inherited from class org.nuxeo.lib.stream.log.internals.AbstractLogManager
checkInvalidAssignment, checkInvalidCodec, cleanTailers, createIfNotExists, createTailer, getAppender, getLatencyPerPartition, guessCodec, sameCodec, size, subscribe
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nuxeo.lib.stream.log.LogManager
createIfNotExists, 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
-
DISABLE_SUBSCRIBE_PROP
public static final String DISABLE_SUBSCRIBE_PROP
- See Also:
- Constant Field Values
-
configs
protected final List<KafkaLogConfig> configs
-
defaultConfig
protected final KafkaLogConfig defaultConfig
-
kUtils
protected final Map<KafkaLogConfig,KafkaUtils> kUtils
-
-
Constructor Detail
-
KafkaLogManager
public KafkaLogManager(String prefix, Properties producerProperties, Properties consumerProperties)
- Since:
- 10.2
-
KafkaLogManager
public KafkaLogManager(List<KafkaLogConfig> kafkaConfigs)
- Since:
- 11.1
-
-
Method Detail
-
findDefaultConfig
protected KafkaLogConfig findDefaultConfig()
-
getConfig
protected KafkaLogConfig getConfig(Name name)
-
getConfig
protected KafkaLogConfig getConfig(Name name, Name group)
-
create
public void create(Name name, int size)
- Specified by:
createin classAbstractLogManager
-
getSize
protected int getSize(Name name)
- Specified by:
getSizein classAbstractLogManager
-
exists
public boolean exists(Name name)
Description copied from interface:LogManagerReturnstrueif a Log with thisnameexists.
-
createAppender
public <M extends Externalizable> CloseableLogAppender<M> createAppender(Name name, Codec<M> codec)
- Specified by:
createAppenderin classAbstractLogManager
-
doCreateTailer
protected <M extends Externalizable> LogTailer<M> doCreateTailer(Collection<LogPartition> partitions, Name group, Codec<M> codec)
- Specified by:
doCreateTailerin classAbstractLogManager
-
checkValidPartition
protected void checkValidPartition(LogPartition partition)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceLogManager- Overrides:
closein classAbstractLogManager
-
supportSubscribe
public 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. Now deprecated because some implementations support subscribe only on specific Log names.- Specified by:
supportSubscribein interfaceLogManager- Overrides:
supportSubscribein classAbstractLogManager
-
supportSubscribe
public boolean supportSubscribe(Name stream)
Description copied from interface:LogManagerReturnstrueif theLogManager.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 for the specific Log.- Specified by:
supportSubscribein interfaceLogManager- Overrides:
supportSubscribein classAbstractLogManager
-
doSubscribe
protected <M extends Externalizable> LogTailer<M> doSubscribe(Name group, Collection<Name> names, RebalanceListener listener, Codec<M> codec)
- Specified by:
doSubscribein classAbstractLogManager
-
getLagPerPartition
public 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 interfaceLogManager- Specified by:
getLagPerPartitionin classAbstractLogManager
-
listAllNames
public List<Name> listAllNames()
Description copied from interface:LogManagerReturns all the Log names.
-
filterDisplayedProperties
protected String filterDisplayedProperties(Properties properties)
-
listConsumerGroups
public List<Name> listConsumerGroups(Name name)
Description copied from interface:LogManagerList the consumer groups for a Log.
-
delete
public 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 interfaceLogManager- Overrides:
deletein classAbstractLogManager
-
deleteRecords
public void deleteRecords(Name name)
Description copied from interface:LogManagerDelete 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.
-
deleteConsumers
public void deleteConsumers()
Description copied from interface:LogManagerRemove all existing consumers and their committed positions. Exposed for testing purpose, might not be implemented by all implementation.
-
-