JingsongLi commented on a change in pull request #10468: [FLINK-14649][table
sql / api] Flatten all the connector properties keys to make it easy to
configure in DDL
URL: https://github.com/apache/flink/pull/10468#discussion_r355122543
##########
File path:
flink-connectors/flink-connector-elasticsearch-base/src/main/java/org/apache/flink/table/descriptors/ElasticsearchValidator.java
##########
@@ -126,4 +137,39 @@ private void
validateConnectionProperties(DescriptorProperties properties) {
properties.validateInt(CONNECTOR_CONNECTION_MAX_RETRY_TIMEOUT,
true, 1);
properties.validateString(CONNECTOR_CONNECTION_PATH_PREFIX,
true);
}
+
+ /**
+ * Parse Hosts String to list.
+ *
+ * <p>Hosts String format was given as following:
+ *
+ * <pre>
+ * connector.hosts = http://host_name:9092;http://host_name:9093
+ * </pre>
+ * @param descriptorProperties
+ * @return
+ */
+ public static List<ElasticsearchUpsertTableSinkBase.Host>
validateAndGetHostsStr(DescriptorProperties descriptorProperties) {
+ final List<ElasticsearchUpsertTableSinkBase.Host> hostList =
new ArrayList<>();
+
+ final String hostsStr =
descriptorProperties.getString(CONNECTOR_HOSTS);
+ if (null == hostsStr || hostsStr.length() == 0) {
+ throw new ValidationException("Properties '" +
CONNECTOR_HOSTS + "' can not be empty, but is:" + hostsStr);
+ }
+
+ final String[] hosts = hostsStr.split(";");
+ for (String host: hosts) {
Review comment:
`host:` -> `host :`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services