Java Code Examples for org.apache.flink.util.PropertiesUtil#getLong()

The following examples show how to use org.apache.flink.util.PropertiesUtil#getLong() . 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: FlinkKafkaConsumer08.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected AbstractFetcher<T, ?> createFetcher(
		SourceContext<T> sourceContext,
		Map<KafkaTopicPartition, Long> assignedPartitionsWithInitialOffsets,
		SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic,
		SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated,
		StreamingRuntimeContext runtimeContext,
		OffsetCommitMode offsetCommitMode,
		MetricGroup consumerMetricGroup,
		boolean useMetrics) throws Exception {

	long autoCommitInterval = (offsetCommitMode == OffsetCommitMode.KAFKA_PERIODIC)
			? PropertiesUtil.getLong(kafkaProperties, "auto.commit.interval.ms", 60000)
			: -1; // this disables the periodic offset committer thread in the fetcher

	return new Kafka08Fetcher<>(
			sourceContext,
			assignedPartitionsWithInitialOffsets,
			watermarksPeriodic,
			watermarksPunctuated,
			runtimeContext,
			deserializer,
			kafkaProperties,
			autoCommitInterval,
			consumerMetricGroup,
			useMetrics);
}
 
Example 2
Source File: FlinkKafkaConsumer08.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected AbstractFetcher<T, ?> createFetcher(
		SourceContext<T> sourceContext,
		Map<KafkaTopicPartition, Long> assignedPartitionsWithInitialOffsets,
		SerializedValue<AssignerWithPeriodicWatermarks<T>> watermarksPeriodic,
		SerializedValue<AssignerWithPunctuatedWatermarks<T>> watermarksPunctuated,
		StreamingRuntimeContext runtimeContext,
		OffsetCommitMode offsetCommitMode,
		MetricGroup consumerMetricGroup,
		boolean useMetrics) throws Exception {

	long autoCommitInterval = (offsetCommitMode == OffsetCommitMode.KAFKA_PERIODIC)
			? PropertiesUtil.getLong(kafkaProperties, "auto.commit.interval.ms", 60000)
			: -1; // this disables the periodic offset committer thread in the fetcher

	return new Kafka08Fetcher<>(
			sourceContext,
			assignedPartitionsWithInitialOffsets,
			watermarksPeriodic,
			watermarksPunctuated,
			runtimeContext,
			deserializer,
			kafkaProperties,
			autoCommitInterval,
			consumerMetricGroup,
			useMetrics);
}
 
Example 3
Source File: FlinkKafkaConsumer09.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
			PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}
 
Example 4
Source File: FlinkKafkaConsumer08.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return PropertiesUtil.getBoolean(kafkaProperties, "auto.commit.enable", true) &&
			PropertiesUtil.getLong(kafkaProperties, "auto.commit.interval.ms", 60000) > 0;
}
 
Example 5
Source File: FlinkKafkaConsumer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
		PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}
 
Example 6
Source File: FlinkKafkaConsumer09.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
			PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}
 
Example 7
Source File: FlinkKafkaConsumer08.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return PropertiesUtil.getBoolean(kafkaProperties, "auto.commit.enable", true) &&
			PropertiesUtil.getLong(kafkaProperties, "auto.commit.interval.ms", 60000) > 0;
}
 
Example 8
Source File: FlinkKafkaConsumer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
		PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}
 
Example 9
Source File: ConfigWrapper.java    From aliyun-log-flink-connector with Apache License 2.0 4 votes vote down vote up
public long getLong(String key, long defaultValue) {
    return PropertiesUtil.getLong(props, key, defaultValue);
}
 
Example 10
Source File: LogUtil.java    From aliyun-log-flink-connector with Apache License 2.0 4 votes vote down vote up
public static long getDiscoveryIntervalMs(Properties props) {
    return PropertiesUtil.getLong(props,
            ConfigConstants.LOG_SHARDS_DISCOVERY_INTERVAL_MILLIS,
            Consts.DEFAULT_SHARDS_DISCOVERY_INTERVAL_MILLIS);
}
 
Example 11
Source File: LogUtil.java    From aliyun-log-flink-connector with Apache License 2.0 4 votes vote down vote up
public static long getCommitIntervalMs(Properties props) {
    return PropertiesUtil.getLong(props,
            ConfigConstants.LOG_COMMIT_INTERVAL_MILLIS,
            Consts.DEFAULT_COMMIT_INTERVAL_MILLIS);
}
 
Example 12
Source File: LogUtil.java    From aliyun-log-flink-connector with Apache License 2.0 4 votes vote down vote up
public static long getFetchIntervalMillis(Properties properties) {
    return PropertiesUtil.getLong(properties,
            ConfigConstants.LOG_FETCH_DATA_INTERVAL_MILLIS,
            Consts.DEFAULT_FETCH_INTERVAL_MILLIS);
}
 
Example 13
Source File: FlinkKafkaConsumer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
		PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}
 
Example 14
Source File: FlinkKafkaConsumer010.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean getIsAutoCommitEnabled() {
	return getBoolean(properties, ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, true) &&
		PropertiesUtil.getLong(properties, ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, 5000) > 0;
}