Search in sources :

Example 1 with KafkaOffsetRetrievalFailureException

use of org.apache.gobblin.source.extractor.extract.kafka.KafkaOffsetRetrievalFailureException in project incubator-gobblin by apache.

the class SimpleKafkaSpecConsumer method initializeHighWatermarks.

private void initializeHighWatermarks() {
    try {
        int i = 0;
        for (KafkaPartition kafkaPartition : _partitions) {
            long latestOffset = _kafkaConsumer.getLatestOffset(kafkaPartition);
            _highWatermark.set(i, latestOffset);
            i++;
        }
    } catch (KafkaOffsetRetrievalFailureException e) {
        throw new RuntimeException(e);
    }
}
Also used : KafkaPartition(org.apache.gobblin.source.extractor.extract.kafka.KafkaPartition) KafkaOffsetRetrievalFailureException(org.apache.gobblin.source.extractor.extract.kafka.KafkaOffsetRetrievalFailureException)

Example 2 with KafkaOffsetRetrievalFailureException

use of org.apache.gobblin.source.extractor.extract.kafka.KafkaOffsetRetrievalFailureException in project incubator-gobblin by apache.

the class SimpleKafkaSpecConsumer method initializeLowWatermarks.

private void initializeLowWatermarks() {
    try {
        int i = 0;
        for (KafkaPartition kafkaPartition : _partitions) {
            if (isFirstRun) {
                long earliestOffset = _kafkaConsumer.getEarliestOffset(kafkaPartition);
                _lowWatermark.set(i, earliestOffset);
            } else {
                _lowWatermark.set(i, _highWatermark.get(i));
            }
            i++;
        }
        isFirstRun = false;
    } catch (KafkaOffsetRetrievalFailureException e) {
        throw new RuntimeException(e);
    }
}
Also used : KafkaPartition(org.apache.gobblin.source.extractor.extract.kafka.KafkaPartition) KafkaOffsetRetrievalFailureException(org.apache.gobblin.source.extractor.extract.kafka.KafkaOffsetRetrievalFailureException)

Aggregations

KafkaOffsetRetrievalFailureException (org.apache.gobblin.source.extractor.extract.kafka.KafkaOffsetRetrievalFailureException)2 KafkaPartition (org.apache.gobblin.source.extractor.extract.kafka.KafkaPartition)2