You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ar...@apache.org on 2021/08/26 11:25:18 UTC
[flink] 03/06: [FLINK-23877][connector/pulsar] Change pulsar config
option's type, drop PulsarJsonUtils, make it strong type support.
This is an automated email from the ASF dual-hosted git repository.
arvid pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 069e4374db57d07910885930b7efd301b730ce74
Author: Yufan Sheng <yu...@streamnative.io>
AuthorDate: Thu Aug 26 04:38:17 2021 +0800
[FLINK-23877][connector/pulsar] Change pulsar config option's type, drop PulsarJsonUtils, make it strong type support.
---
.../pulsar/common/config/PulsarConfigUtils.java | 48 +++--------
.../pulsar/common/config/PulsarOptions.java | 55 ++++++------
.../pulsar/common/utils/PulsarJsonUtils.java | 98 ----------------------
.../pulsar/source/PulsarSourceBuilder.java | 10 +--
.../pulsar/source/PulsarSourceOptions.java | 20 +++--
.../source/config/PulsarSourceConfigUtils.java | 8 +-
6 files changed, 56 insertions(+), 183 deletions(-)
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigUtils.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigUtils.java
index fa9c143..ae5d784 100644
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigUtils.java
+++ b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigUtils.java
@@ -21,7 +21,6 @@ package org.apache.flink.connector.pulsar.common.config;
import org.apache.flink.annotation.Internal;
import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.pulsar.common.utils.PulsarJsonUtils;
import org.apache.pulsar.client.admin.PulsarAdmin;
import org.apache.pulsar.client.admin.PulsarAdminBuilder;
@@ -33,6 +32,7 @@ import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.impl.auth.AuthenticationDisabled;
import java.util.Map;
+import java.util.TreeSet;
import java.util.function.Consumer;
import java.util.function.Function;
@@ -100,7 +100,6 @@ public final class PulsarConfigUtils {
setOptionValue(
configuration,
PULSAR_OPERATION_TIMEOUT_MS,
- Math::toIntExact,
timeout -> builder.operationTimeout(timeout, MILLISECONDS));
setOptionValue(configuration, PULSAR_NUM_IO_THREADS, builder::ioThreads);
setOptionValue(configuration, PULSAR_NUM_LISTENER_THREADS, builder::listenerThreads);
@@ -122,16 +121,8 @@ public final class PulsarConfigUtils {
setOptionValue(configuration, PULSAR_TLS_TRUST_STORE_PATH, builder::tlsTrustStorePath);
setOptionValue(
configuration, PULSAR_TLS_TRUST_STORE_PASSWORD, builder::tlsTrustStorePassword);
- setOptionValue(
- configuration,
- PULSAR_TLS_CIPHERS,
- v -> PulsarJsonUtils.toSet(String.class, v),
- builder::tlsCiphers);
- setOptionValue(
- configuration,
- PULSAR_TLS_PROTOCOLS,
- v -> PulsarJsonUtils.toSet(String.class, v),
- builder::tlsProtocols);
+ setOptionValue(configuration, PULSAR_TLS_CIPHERS, TreeSet::new, builder::tlsCiphers);
+ setOptionValue(configuration, PULSAR_TLS_PROTOCOLS, TreeSet::new, builder::tlsProtocols);
setOptionValue(
configuration,
PULSAR_MEMORY_LIMIT_BYTES,
@@ -202,35 +193,21 @@ public final class PulsarConfigUtils {
setOptionValue(configuration, PULSAR_TLS_TRUST_STORE_PATH, builder::tlsTrustStorePath);
setOptionValue(
configuration, PULSAR_TLS_TRUST_STORE_PASSWORD, builder::tlsTrustStorePassword);
- setOptionValue(
- configuration,
- PULSAR_TLS_CIPHERS,
- v -> PulsarJsonUtils.toSet(String.class, v),
- builder::tlsCiphers);
- setOptionValue(
- configuration,
- PULSAR_TLS_PROTOCOLS,
- v -> PulsarJsonUtils.toSet(String.class, v),
- builder::tlsProtocols);
+ setOptionValue(configuration, PULSAR_TLS_CIPHERS, TreeSet::new, builder::tlsCiphers);
+ setOptionValue(configuration, PULSAR_TLS_PROTOCOLS, TreeSet::new, builder::tlsProtocols);
setOptionValue(
configuration,
PULSAR_CONNECT_TIMEOUT,
- Math::toIntExact,
v -> builder.connectionTimeout(v, MILLISECONDS));
setOptionValue(
- configuration,
- PULSAR_READ_TIMEOUT,
- Math::toIntExact,
- v -> builder.readTimeout(v, MILLISECONDS));
+ configuration, PULSAR_READ_TIMEOUT, v -> builder.readTimeout(v, MILLISECONDS));
setOptionValue(
configuration,
PULSAR_REQUEST_TIMEOUT,
- Math::toIntExact,
v -> builder.requestTimeout(v, MILLISECONDS));
setOptionValue(
configuration,
PULSAR_AUTO_CERT_REFRESH_TIME,
- Math::toIntExact,
v -> builder.autoCertRefreshTime(v, MILLISECONDS));
return sneakyClient(builder::build);
@@ -243,7 +220,7 @@ public final class PulsarConfigUtils {
*
* <p>This method behavior is the same as the pulsar command line tools.
*/
- public static Authentication createAuthentication(Configuration configuration) {
+ private static Authentication createAuthentication(Configuration configuration) {
if (configuration.contains(PULSAR_AUTH_PLUGIN_CLASS_NAME)) {
String authPluginClassName = configuration.get(PULSAR_AUTH_PLUGIN_CLASS_NAME);
@@ -252,13 +229,14 @@ public final class PulsarConfigUtils {
return sneakyClient(
() -> AuthenticationFactory.create(authPluginClassName, authParamsString));
} else if (configuration.contains(PULSAR_AUTH_PARAM_MAP)) {
- Map<String, String> paramsMap =
- getOptionValue(
- configuration,
- PULSAR_AUTH_PARAM_MAP,
- v -> PulsarJsonUtils.toMap(String.class, String.class, v));
+ Map<String, String> paramsMap = configuration.get(PULSAR_AUTH_PARAM_MAP);
return sneakyClient(
() -> AuthenticationFactory.create(authPluginClassName, paramsMap));
+ } else {
+ throw new IllegalArgumentException(
+ String.format(
+ "No %s or %s provided",
+ PULSAR_AUTH_PARAMS.key(), PULSAR_AUTH_PARAM_MAP.key()));
}
}
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarOptions.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarOptions.java
index 88c1304..0891e7b 100644
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarOptions.java
+++ b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarOptions.java
@@ -25,8 +25,11 @@ import org.apache.flink.configuration.description.Description;
import org.apache.pulsar.client.api.ProxyProtocol;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
+import static java.util.Collections.emptyMap;
import static org.apache.flink.configuration.description.TextElement.code;
import static org.apache.flink.configuration.description.TextElement.text;
@@ -108,16 +111,15 @@ public final class PulsarOptions {
.add(code("key1:val1,key2:val2"))
.build());
- // The real config type is Map<String, String>, you should provided a json str here.
- public static final ConfigOption<String> PULSAR_AUTH_PARAM_MAP =
+ public static final ConfigOption<Map<String, String>> PULSAR_AUTH_PARAM_MAP =
ConfigOptions.key(CLIENT_CONFIG_PREFIX + "authParamMap")
- .stringType()
- .defaultValue("{}");
+ .mapType()
+ .defaultValue(emptyMap());
- public static final ConfigOption<Long> PULSAR_OPERATION_TIMEOUT_MS =
+ public static final ConfigOption<Integer> PULSAR_OPERATION_TIMEOUT_MS =
ConfigOptions.key(CLIENT_CONFIG_PREFIX + "operationTimeoutMs")
- .longType()
- .defaultValue(30000L)
+ .intType()
+ .defaultValue(30000)
.withDescription("Operation timeout.");
public static final ConfigOption<Long> PULSAR_STATS_INTERVAL_SECONDS =
@@ -235,6 +237,7 @@ public final class PulsarOptions {
"If the duration passes without a response from a broker, the connection attempt is dropped.")
.build());
+ // TODO This option would be exposed by Pulsar's ClientBuilder in next release.
public static final ConfigOption<Integer> PULSAR_REQUEST_TIMEOUT_MS =
ConfigOptions.key(CLIENT_CONFIG_PREFIX + "requestTimeoutMs")
.intType()
@@ -284,15 +287,17 @@ public final class PulsarOptions {
.stringType()
.noDefaultValue();
- // The real config type is Set<String>, you should provided a json str here.
- public static final ConfigOption<String> PULSAR_TLS_CIPHERS =
- ConfigOptions.key(CLIENT_CONFIG_PREFIX + "tlsCiphers").stringType().defaultValue("[]");
+ public static final ConfigOption<List<String>> PULSAR_TLS_CIPHERS =
+ ConfigOptions.key(CLIENT_CONFIG_PREFIX + "tlsCiphers")
+ .stringType()
+ .asList()
+ .defaultValues();
- // The real config type is Set<String>, you should provided a json str here.
- public static final ConfigOption<String> PULSAR_TLS_PROTOCOLS =
+ public static final ConfigOption<List<String>> PULSAR_TLS_PROTOCOLS =
ConfigOptions.key(CLIENT_CONFIG_PREFIX + "tlsProtocols")
.stringType()
- .defaultValue("[]");
+ .asList()
+ .defaultValues();
public static final ConfigOption<Long> PULSAR_MEMORY_LIMIT_BYTES =
ConfigOptions.key(CLIENT_CONFIG_PREFIX + "memoryLimitBytes")
@@ -328,26 +333,22 @@ public final class PulsarOptions {
.withDescription("Admin URL for Pulsar service.");
// The network connect timeout in millis.
- public static final ConfigOption<Long> PULSAR_CONNECT_TIMEOUT =
- ConfigOptions.key(ADMIN_CONFIG_PREFIX + "connectTimeout")
- .longType()
- .defaultValue(TimeUnit.SECONDS.toMillis(60));
+ public static final ConfigOption<Integer> PULSAR_CONNECT_TIMEOUT =
+ ConfigOptions.key(ADMIN_CONFIG_PREFIX + "connectTimeout").intType().defaultValue(60000);
// The read timeout in millis.
- public static final ConfigOption<Long> PULSAR_READ_TIMEOUT =
- ConfigOptions.key(ADMIN_CONFIG_PREFIX + "readTimeout")
- .longType()
- .defaultValue(TimeUnit.SECONDS.toMillis(60));
+ public static final ConfigOption<Integer> PULSAR_READ_TIMEOUT =
+ ConfigOptions.key(ADMIN_CONFIG_PREFIX + "readTimeout").intType().defaultValue(60000);
// The request timeout in millis.
- public static final ConfigOption<Long> PULSAR_REQUEST_TIMEOUT =
+ public static final ConfigOption<Integer> PULSAR_REQUEST_TIMEOUT =
ConfigOptions.key(ADMIN_CONFIG_PREFIX + "requestTimeout")
- .longType()
- .defaultValue(TimeUnit.SECONDS.toMillis(300));
+ .intType()
+ .defaultValue(300000);
// The auto refresh time for certification in millis.
- public static final ConfigOption<Long> PULSAR_AUTO_CERT_REFRESH_TIME =
+ public static final ConfigOption<Integer> PULSAR_AUTO_CERT_REFRESH_TIME =
ConfigOptions.key(ADMIN_CONFIG_PREFIX + "autoCertRefreshTime")
- .longType()
- .defaultValue(TimeUnit.SECONDS.toMillis(300));
+ .intType()
+ .defaultValue(300000);
}
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/utils/PulsarJsonUtils.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/utils/PulsarJsonUtils.java
deleted file mode 100644
index 64308bc..0000000
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/utils/PulsarJsonUtils.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.flink.connector.pulsar.common.utils;
-
-import org.apache.flink.annotation.Internal;
-
-import org.apache.pulsar.shade.com.fasterxml.jackson.core.JsonProcessingException;
-import org.apache.pulsar.shade.com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.pulsar.shade.com.fasterxml.jackson.databind.type.CollectionType;
-import org.apache.pulsar.shade.com.fasterxml.jackson.databind.type.MapType;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/** json util for pulsar configuration. */
-@Internal
-public final class PulsarJsonUtils {
-
- /**
- * Pulsar client shade a jackson and use jackson annotation in its config class. We have to use
- * this shaded jackson here.
- */
- private static final ObjectMapper mapper = new ObjectMapper();
-
- private PulsarJsonUtils() {
- // No need to create instance.
- }
-
- public static <K, V> Map<K, V> toMap(Class<K> kClass, Class<V> vClass, String json) {
- return toMap(HashMap.class, kClass, vClass, json);
- }
-
- public static <K, V> Map<K, V> toMap(
- Class<? extends Map> mapClass, Class<K> kClass, Class<V> vClass, String json) {
- MapType mapType = mapper.getTypeFactory().constructMapType(mapClass, kClass, vClass);
- try {
- return mapper.readValue(json, mapType);
- } catch (JsonProcessingException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static <T> Set<T> toSet(Class<T> clazz, String json) {
- return toSet(TreeSet.class, clazz, json);
- }
-
- public static <T> Set<T> toSet(Class<? extends Set> setClass, Class<T> clazz, String json) {
- CollectionType collectionType =
- mapper.getTypeFactory().constructCollectionType(setClass, clazz);
- try {
- return mapper.readValue(json, collectionType);
- } catch (JsonProcessingException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static <T> List<T> toList(Class<T> clazz, String json) {
- return toList(ArrayList.class, clazz, json);
- }
-
- public static <T> List<T> toList(Class<? extends List> listClass, Class<T> clazz, String json) {
- CollectionType collectionType =
- mapper.getTypeFactory().constructCollectionType(listClass, clazz);
- try {
- return mapper.readValue(json, collectionType);
- } catch (JsonProcessingException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static String toString(Object o) {
- try {
- return mapper.writeValueAsString(o);
- } catch (JsonProcessingException e) {
- throw new IllegalArgumentException(e);
- }
- }
-}
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceBuilder.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceBuilder.java
index 50d93fa..20064f5 100644
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceBuilder.java
+++ b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceBuilder.java
@@ -25,7 +25,6 @@ import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.ConfigOptions;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.UnmodifiableConfiguration;
-import org.apache.flink.connector.pulsar.common.utils.PulsarJsonUtils;
import org.apache.flink.connector.pulsar.source.enumerator.cursor.StartCursor;
import org.apache.flink.connector.pulsar.source.enumerator.cursor.StopCursor;
import org.apache.flink.connector.pulsar.source.enumerator.subscriber.PulsarSubscriber;
@@ -48,7 +47,6 @@ import java.util.Properties;
import java.util.regex.Pattern;
import static java.lang.Boolean.FALSE;
-import static org.apache.flink.connector.pulsar.common.config.PulsarConfigUtils.getOptionValue;
import static org.apache.flink.connector.pulsar.common.config.PulsarOptions.PULSAR_ADMIN_URL;
import static org.apache.flink.connector.pulsar.common.config.PulsarOptions.PULSAR_ENABLE_TRANSACTION;
import static org.apache.flink.connector.pulsar.common.config.PulsarOptions.PULSAR_SERVICE_URL;
@@ -210,7 +208,7 @@ public final class PulsarSourceBuilder<OUT> {
*/
public PulsarSourceBuilder<OUT> setTopics(List<String> topics) {
ensureSubscriberIsNull("topics");
- configuration.set(PULSAR_TOPIC_NAMES, PulsarJsonUtils.toString(topics));
+ configuration.set(PULSAR_TOPIC_NAMES, topics);
this.subscriber = PulsarSubscriber.getTopicListSubscriber(topics);
return this;
}
@@ -438,11 +436,7 @@ public final class PulsarSourceBuilder<OUT> {
// Ensure the topic subscriber for pulsar.
if (subscriber == null) {
if (configuration.contains(PULSAR_TOPIC_NAMES)) {
- List<String> topics =
- getOptionValue(
- configuration,
- PULSAR_TOPIC_NAMES,
- names -> PulsarJsonUtils.toList(String.class, names));
+ List<String> topics = configuration.get(PULSAR_TOPIC_NAMES);
this.subscriber = PulsarSubscriber.getTopicListSubscriber(topics);
} else if (configuration.contains(PULSAR_TOPICS_PATTERN)) {
String topicPatternStr = configuration.get(PULSAR_TOPICS_PATTERN);
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceOptions.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceOptions.java
index 3cac072..1e45a3d 100644
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceOptions.java
+++ b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/PulsarSourceOptions.java
@@ -32,8 +32,11 @@ import org.apache.pulsar.client.api.SubscriptionMode;
import org.apache.pulsar.client.api.SubscriptionType;
import java.time.Duration;
+import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
+import static java.util.Collections.emptyMap;
import static org.apache.flink.configuration.description.TextElement.code;
import static org.apache.flink.configuration.description.TextElement.text;
@@ -158,10 +161,11 @@ public final class PulsarSourceOptions {
//
///////////////////////////////////////////////////////////////////////////////
- public static final ConfigOption<String> PULSAR_TOPIC_NAMES =
+ public static final ConfigOption<List<String>> PULSAR_TOPIC_NAMES =
ConfigOptions.key(CONSUMER_CONFIG_PREFIX + "topicNames")
.stringType()
- .defaultValue("[]")
+ .asList()
+ .defaultValues()
.withDescription("Topic name.");
public static final ConfigOption<String> PULSAR_TOPICS_PATTERN =
@@ -364,10 +368,10 @@ public final class PulsarSourceOptions {
code("EncryptionContext"))
.build());
- public static final ConfigOption<String> PULSAR_CONSUMER_PROPERTIES =
+ public static final ConfigOption<Map<String, String>> PULSAR_CONSUMER_PROPERTIES =
ConfigOptions.key(CONSUMER_CONFIG_PREFIX + "properties")
- .stringType()
- .defaultValue("{}")
+ .mapType()
+ .defaultValue(emptyMap())
.withDescription(
Description.builder()
.text("A name or value property of this consumer.")
@@ -498,10 +502,10 @@ public final class PulsarSourceOptions {
.text("Note: this is only for partitioned consumers.\t")
.build());
- public static final ConfigOption<Long> PULSAR_AUTO_UPDATE_PARTITIONS_INTERVAL_SECONDS =
+ public static final ConfigOption<Integer> PULSAR_AUTO_UPDATE_PARTITIONS_INTERVAL_SECONDS =
ConfigOptions.key(CONSUMER_CONFIG_PREFIX + "autoUpdatePartitionsIntervalSeconds")
- .longType()
- .defaultValue(60L);
+ .intType()
+ .defaultValue(60);
public static final ConfigOption<Boolean> PULSAR_REPLICATE_SUBSCRIPTION_STATE =
ConfigOptions.key(CONSUMER_CONFIG_PREFIX + "replicateSubscriptionState")
diff --git a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/config/PulsarSourceConfigUtils.java b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/config/PulsarSourceConfigUtils.java
index a471bc6..e19dcd5 100644
--- a/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/config/PulsarSourceConfigUtils.java
+++ b/flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/config/PulsarSourceConfigUtils.java
@@ -21,7 +21,6 @@ package org.apache.flink.connector.pulsar.source.config;
import org.apache.flink.annotation.Internal;
import org.apache.flink.configuration.ConfigOption;
import org.apache.flink.configuration.Configuration;
-import org.apache.flink.connector.pulsar.common.utils.PulsarJsonUtils;
import org.apache.flink.util.Preconditions;
import org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList;
@@ -156,11 +155,7 @@ public final class PulsarSourceConfigUtils {
setOptionValue(configuration, PULSAR_CONSUMER_NAME, builder::consumerName);
setOptionValue(configuration, PULSAR_READ_COMPACTED, builder::readCompacted);
setOptionValue(configuration, PULSAR_PRIORITY_LEVEL, builder::priorityLevel);
- setOptionValue(
- configuration,
- PULSAR_CONSUMER_PROPERTIES,
- v -> PulsarJsonUtils.toMap(String.class, String.class, v),
- builder::properties);
+ setOptionValue(configuration, PULSAR_CONSUMER_PROPERTIES, builder::properties);
setOptionValue(
configuration,
PULSAR_SUBSCRIPTION_INITIAL_POSITION,
@@ -170,7 +165,6 @@ public final class PulsarSourceConfigUtils {
setOptionValue(
configuration,
PULSAR_AUTO_UPDATE_PARTITIONS_INTERVAL_SECONDS,
- Math::toIntExact,
v -> builder.autoUpdatePartitionsInterval(v, SECONDS));
if (configuration.getOptional(PULSAR_RESET_INCLUDE_HEAD).orElse(false)) {
builder.startMessageIdInclusive();