K - record key typeV - record value typepublic class StandardPartitionImpl<K,V> extends AbstractPartition<K,V>
IPartition implementation when consumer work with a straigth commit strategy, not requesting
the fancy offset tree mode.
This implementation is ok with auto commit strategy, or if it is good for you to commit all the records that have been polled up to some point.
consumer, earliestOffset, latestOffset, partitionNumber, topiccommitLatency, committedOffsetGauge, currentDelayGauge, currentTimestampGauge, earliestOffsetGauge, fetchSize, latestOffsetGauge, messagesCommitBacklogGauge, messagesFetchBacklogGauge, messagesPersistedBacklogGauge, messagesReplayableGauge, metricsContext, msgFetchRate, offsetAckRate, offsetFailRate| Modifier | Constructor and Description |
|---|---|
protected |
StandardPartitionImpl(org.thales.punch.libraries.metrics.api.IMetricContext metricContext,
String topic,
int partitionNumber,
org.apache.kafka.clients.consumer.KafkaConsumer<K,V> consumer,
long offsetToRead,
Long offsetWatchDogTimeout)
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
commit(long offset,
String metaData)
Commit an explicit offset for the given partition.
|
void |
commit(String metadata)
Commit the latest acknowledged offset for the given partition.
|
protected void |
onReceive(IRecordHandler<K,V> receiver,
org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
Transfer the record to the receiver.
|
String |
toString() |
attach, getAttachment, getPartitionNumber, getTopic, setEarliestOffset, setLatestOffsetcloseclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitack, close, fail, rewindprotected StandardPartitionImpl(org.thales.punch.libraries.metrics.api.IMetricContext metricContext,
String topic,
int partitionNumber,
org.apache.kafka.clients.consumer.KafkaConsumer<K,V> consumer,
long offsetToRead,
Long offsetWatchDogTimeout)
topic - the target topicpartitionNumber - the partition number.consumer - the associated KafkaConsumeroffsetToRead - : the current offset at which the consumer is configured to fetch data for this partition.offsetWatchDogTimeout - the watchdog committed offset timeout in ms.protected void onReceive(IRecordHandler<K,V> receiver, org.apache.kafka.clients.consumer.ConsumerRecord<K,V> record)
onReceive in class AbstractPartition<K,V>receiver - the record receiverrecord - the recordpublic void commit(String metadata)
IPartitionmetadata - an optional metadata, can be null. If not it will be saved along with the commitpublic void commit(long offset,
String metaData)
IPartitionoffset - the offset to commit. Remember you should always commit +1 the latest processed message (this is the kafka way).metaData - an optional metadata, can be null. If not it will be saved along with the commit. It should relate to the NEXT data to read and processCopyright © 2014–2023. All rights reserved.