Package cz.o2.proxima.direct.io.kafka
Class KafkaAccessor
- java.lang.Object
- 
- cz.o2.proxima.core.storage.AbstractStorage
- 
- cz.o2.proxima.core.storage.AbstractStorage.SerializableAbstractStorage
- 
- cz.o2.proxima.direct.io.kafka.KafkaAccessor
 
 
 
- 
- All Implemented Interfaces:
- AbstractDataAccessor,- DataAccessor,- java.io.Serializable
 
 public class KafkaAccessor extends AbstractStorage.SerializableAbstractStorage implements DataAccessor Kafka writer and commit log usingKafkaProducer.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class cz.o2.proxima.core.storage.AbstractStorageAbstractStorage.SerializableAbstractStorage
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringASSIGNMENT_TIMEOUT_MSTimeout in milliseconds, that consumer should wait for group assignment before throwing an exception.static java.lang.StringAUTO_COMMIT_INTERVAL_MSAuto commit interval in milliseconds.static java.lang.StringEMPTY_POLL_TIMEMinimal time poll() has to return empty records, before first moving watermark to processing time.static java.lang.StringKAFKA_CONFIG_PREFIXstatic java.lang.StringLOG_STALE_COMMIT_INTERVAL_MSLog stale commit interval in milliseconds.static java.lang.StringMAX_BYTES_PER_SECMaximal read speed in bytes per second.static java.lang.StringPARTITIONER_CLASSPartitioner class for entity key-attribute pair.static java.lang.StringPOLL_INTERVAL_CFGA poll interval in milliseconds.static java.lang.StringSEQUENCE_ID_HEADERA name for a header containing sequential ID ofStreamElement(if any).static java.lang.StringSERIALIZER_CLASSClass performing parsing from (String, byte[]) to StreamElement.static java.lang.StringUUID_HEADERA name for a header containing UUID ofStreamElement
 - 
Constructor SummaryConstructors Constructor Description KafkaAccessor(EntityDescriptor entity, java.net.URI uri, java.util.Map<java.lang.String,java.lang.Object> cfg)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <K,V>
 KafkaConsumerFactory<K,V>createConsumerFactory()Create kafka consumer with specific rebalance listener.java.util.Optional<CachedView>getCachedView(Context context)Retrieve cached view of the data.java.util.Optional<CommitLogReader>getCommitLogReader(Context context)Retrieve commit log reader (if applicable).<K,V>
 ElementSerializer<K,V>getSerializer()RetrieveElementSerializer.java.util.Optional<AttributeWriterBase>getWriter(Context context)Retrieve writer (if applicable).booleanisAcceptable(AttributeFamilyDescriptor familyDescriptor)Checker for kafka topics configurationbooleanverifyCleanupPolicy(org.apache.kafka.clients.admin.ConfigEntry cleanupPolicy)- 
Methods inherited from class cz.o2.proxima.core.storage.AbstractStorageequals, hashCode
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface cz.o2.proxima.core.storage.internal.AbstractDataAccessorgetUri
 - 
Methods inherited from interface cz.o2.proxima.direct.core.DataAccessorgetBatchLogReader, getRandomAccessReader
 
- 
 
- 
- 
- 
Field Detail- 
KAFKA_CONFIG_PREFIXpublic static final java.lang.String KAFKA_CONFIG_PREFIX - See Also:
- Constant Field Values
 
 - 
POLL_INTERVAL_CFGpublic static final java.lang.String POLL_INTERVAL_CFG A poll interval in milliseconds.- See Also:
- Constant Field Values
 
 - 
PARTITIONER_CLASSpublic static final java.lang.String PARTITIONER_CLASS Partitioner class for entity key-attribute pair.- See Also:
- Constant Field Values
 
 - 
SERIALIZER_CLASSpublic static final java.lang.String SERIALIZER_CLASS Class performing parsing from (String, byte[]) to StreamElement. This kas to implementElementSerializerinterface.- See Also:
- Constant Field Values
 
 - 
MAX_BYTES_PER_SECpublic static final java.lang.String MAX_BYTES_PER_SEC Maximal read speed in bytes per second.- See Also:
- Constant Field Values
 
 - 
AUTO_COMMIT_INTERVAL_MSpublic static final java.lang.String AUTO_COMMIT_INTERVAL_MS Auto commit interval in milliseconds.- See Also:
- Constant Field Values
 
 - 
LOG_STALE_COMMIT_INTERVAL_MSpublic static final java.lang.String LOG_STALE_COMMIT_INTERVAL_MS Log stale commit interval in milliseconds.- See Also:
- Constant Field Values
 
 - 
ASSIGNMENT_TIMEOUT_MSpublic static final java.lang.String ASSIGNMENT_TIMEOUT_MS Timeout in milliseconds, that consumer should wait for group assignment before throwing an exception.- See Also:
- Constant Field Values
 
 - 
EMPTY_POLL_TIMEpublic static final java.lang.String EMPTY_POLL_TIME Minimal time poll() has to return empty records, before first moving watermark to processing time. This controls time needed to initialize kafka consumer.- See Also:
- Constant Field Values
 
 - 
SEQUENCE_ID_HEADERpublic static final java.lang.String SEQUENCE_ID_HEADER A name for a header containing sequential ID ofStreamElement(if any).- See Also:
- Constant Field Values
 
 - 
UUID_HEADERpublic static final java.lang.String UUID_HEADER A name for a header containing UUID ofStreamElement- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
KafkaAccessorpublic KafkaAccessor(EntityDescriptor entity, java.net.URI uri, java.util.Map<java.lang.String,java.lang.Object> cfg) 
 
- 
 - 
Method Detail- 
createConsumerFactorypublic <K,V> KafkaConsumerFactory<K,V> createConsumerFactory() Create kafka consumer with specific rebalance listener.- Type Parameters:
- K- key type
- V- value type
- Returns:
- KafkaConsumerFactoryfor creating consumers
 
 - 
isAcceptablepublic boolean isAcceptable(AttributeFamilyDescriptor familyDescriptor) Checker for kafka topics configuration- Specified by:
- isAcceptablein interface- DataAccessor
- Parameters:
- familyDescriptor- Attribute family descriptor.
- Returns:
- true if check succeeded, otherwise false
 
 - 
verifyCleanupPolicypublic boolean verifyCleanupPolicy(org.apache.kafka.clients.admin.ConfigEntry cleanupPolicy) 
 - 
getWriterpublic java.util.Optional<AttributeWriterBase> getWriter(Context context) Description copied from interface:DataAccessorRetrieve writer (if applicable).- Specified by:
- getWriterin interface- DataAccessor
- Parameters:
- context- the serializable context provided by repository
- Returns:
- optional AttributeWriterBaseof this accessor
 
 - 
getCommitLogReaderpublic java.util.Optional<CommitLogReader> getCommitLogReader(Context context) Description copied from interface:DataAccessorRetrieve commit log reader (if applicable).- Specified by:
- getCommitLogReaderin interface- DataAccessor
- Parameters:
- context- serializable context provided by repository
- Returns:
- optional @{link CommitLogReader} of this accessor
 
 - 
getCachedViewpublic java.util.Optional<CachedView> getCachedView(Context context) Description copied from interface:DataAccessorRetrieve cached view of the data.- Specified by:
- getCachedViewin interface- DataAccessor
- Parameters:
- context- serializable context provided by repository
- Returns:
- optional CachedViewof this accessor
 
 - 
getSerializerpublic <K,V> ElementSerializer<K,V> getSerializer() RetrieveElementSerializer.- Type Parameters:
- K- the key type
- V- the value type
- Returns:
- the ElementSerializer.
 
 
- 
 
-