Java Code Examples for org.apache.flink.streaming.connectors.kafka.config.StartupMode#SPECIFIC_OFFSETS
The following examples show how to use
org.apache.flink.streaming.connectors.kafka.config.StartupMode#SPECIFIC_OFFSETS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Kafka.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Configures to start reading partitions from specific offsets and specifies the given offset for * the given partition. * * @param partition partition index * @param specificOffset partition offset to start reading from * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffset(int partition, long specificOffset) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; if (this.specificOffsets == null) { this.specificOffsets = new HashMap<>(); } this.specificOffsets.put(partition, specificOffset); return this; }
Example 2
Source File: Kafka.java From flink with Apache License 2.0 | 5 votes |
/** * Configures to start reading partitions from specific offsets and specifies the given offset for * the given partition. * * @param partition partition index * @param specificOffset partition offset to start reading from * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffset(int partition, long specificOffset) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; if (this.specificOffsets == null) { this.specificOffsets = new HashMap<>(); } this.specificOffsets.put(partition, specificOffset); return this; }
Example 3
Source File: Kafka.java From flink with Apache License 2.0 | 5 votes |
/** * Configures to start reading partitions from specific offsets and specifies the given offset for * the given partition. * * @param partition partition index * @param specificOffset partition offset to start reading from * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffset(int partition, long specificOffset) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; if (this.specificOffsets == null) { this.specificOffsets = new HashMap<>(); } this.specificOffsets.put(partition, specificOffset); return this; }
Example 4
Source File: FlinkKafkaConsumerBase.java From Flink-CEPplus with Apache License 2.0 | 3 votes |
/** * Specifies the consumer to start reading partitions from specific offsets, set independently for each partition. * The specified offset should be the offset of the next record that will be read from partitions. * This lets the consumer ignore any committed group offsets in Zookeeper / Kafka brokers. * * <p>If the provided map of offsets contains entries whose {@link KafkaTopicPartition} is not subscribed by the * consumer, the entry will be ignored. If the consumer subscribes to a partition that does not exist in the provided * map of offsets, the consumer will fallback to the default group offset behaviour (see * {@link FlinkKafkaConsumerBase#setStartFromGroupOffsets()}) for that particular partition. * * <p>If the specified offset for a partition is invalid, or the behaviour for that partition is defaulted to group * offsets but still no group offset could be found for it, then the "auto.offset.reset" behaviour set in the * configuration properties will be used for the partition * * <p>This method does not affect where partitions are read from when the consumer is restored * from a checkpoint or savepoint. When the consumer is restored from a checkpoint or * savepoint, only the offsets in the restored state will be used. * * @return The consumer object, to allow function chaining. */ public FlinkKafkaConsumerBase<T> setStartFromSpecificOffsets(Map<KafkaTopicPartition, Long> specificStartupOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.startupOffsetsTimestamp = null; this.specificStartupOffsets = checkNotNull(specificStartupOffsets); return this; }
Example 5
Source File: FlinkKafkaConsumerBase.java From flink with Apache License 2.0 | 3 votes |
/** * Specifies the consumer to start reading partitions from specific offsets, set independently for each partition. * The specified offset should be the offset of the next record that will be read from partitions. * This lets the consumer ignore any committed group offsets in Zookeeper / Kafka brokers. * * <p>If the provided map of offsets contains entries whose {@link KafkaTopicPartition} is not subscribed by the * consumer, the entry will be ignored. If the consumer subscribes to a partition that does not exist in the provided * map of offsets, the consumer will fallback to the default group offset behaviour (see * {@link FlinkKafkaConsumerBase#setStartFromGroupOffsets()}) for that particular partition. * * <p>If the specified offset for a partition is invalid, or the behaviour for that partition is defaulted to group * offsets but still no group offset could be found for it, then the "auto.offset.reset" behaviour set in the * configuration properties will be used for the partition * * <p>This method does not affect where partitions are read from when the consumer is restored * from a checkpoint or savepoint. When the consumer is restored from a checkpoint or * savepoint, only the offsets in the restored state will be used. * * @return The consumer object, to allow function chaining. */ public FlinkKafkaConsumerBase<T> setStartFromSpecificOffsets(Map<KafkaTopicPartition, Long> specificStartupOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.startupOffsetsTimestamp = null; this.specificStartupOffsets = checkNotNull(specificStartupOffsets); return this; }
Example 6
Source File: FlinkKafkaConsumerBase.java From flink with Apache License 2.0 | 3 votes |
/** * Specifies the consumer to start reading partitions from specific offsets, set independently for each partition. * The specified offset should be the offset of the next record that will be read from partitions. * This lets the consumer ignore any committed group offsets in Zookeeper / Kafka brokers. * * <p>If the provided map of offsets contains entries whose {@link KafkaTopicPartition} is not subscribed by the * consumer, the entry will be ignored. If the consumer subscribes to a partition that does not exist in the provided * map of offsets, the consumer will fallback to the default group offset behaviour (see * {@link FlinkKafkaConsumerBase#setStartFromGroupOffsets()}) for that particular partition. * * <p>If the specified offset for a partition is invalid, or the behaviour for that partition is defaulted to group * offsets but still no group offset could be found for it, then the "auto.offset.reset" behaviour set in the * configuration properties will be used for the partition * * <p>This method does not affect where partitions are read from when the consumer is restored * from a checkpoint or savepoint. When the consumer is restored from a checkpoint or * savepoint, only the offsets in the restored state will be used. * * @return The consumer object, to allow function chaining. */ public FlinkKafkaConsumerBase<T> setStartFromSpecificOffsets(Map<KafkaTopicPartition, Long> specificStartupOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.startupOffsetsTimestamp = null; this.specificStartupOffsets = checkNotNull(specificStartupOffsets); return this; }
Example 7
Source File: Kafka.java From Flink-CEPplus with Apache License 2.0 | 2 votes |
/** * Configures to start reading partitions from specific offsets, set independently for each partition. * Resets previously set offsets. * * @param specificOffsets the specified offsets for partitions * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.specificOffsets = Preconditions.checkNotNull(specificOffsets); return this; }
Example 8
Source File: Kafka.java From flink with Apache License 2.0 | 2 votes |
/** * Configures to start reading partitions from specific offsets, set independently for each partition. * Resets previously set offsets. * * @param specificOffsets the specified offsets for partitions * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.specificOffsets = Preconditions.checkNotNull(specificOffsets); return this; }
Example 9
Source File: Kafka.java From flink with Apache License 2.0 | 2 votes |
/** * Configures to start reading partitions from specific offsets, set independently for each partition. * Resets previously set offsets. * * @param specificOffsets the specified offsets for partitions * @see FlinkKafkaConsumerBase#setStartFromSpecificOffsets(Map) */ public Kafka startFromSpecificOffsets(Map<Integer, Long> specificOffsets) { this.startupMode = StartupMode.SPECIFIC_OFFSETS; this.specificOffsets = Preconditions.checkNotNull(specificOffsets); return this; }