imaffe commented on a change in pull request #17452:
URL: https://github.com/apache/flink/pull/17452#discussion_r791349039



##########
File path: flink-connectors/flink-connector-pulsar/pom.xml
##########
@@ -163,13 +202,22 @@ under the License.
                </dependency>
        </dependencies>
 
-       <!-- gRPC use version range which don't support by flink ci. -->
        <dependencyManagement>
                <dependencies>
+                       <!-- Pulsar use higher gRPC version. -->
                        <dependency>
                                <groupId>io.grpc</groupId>
                                <artifactId>grpc-bom</artifactId>
-                               <version>${grpc.version}</version>
+                               <version>${pulsar-grpc.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>

Review comment:
       We use` import` scope to align grpc version to whatever pulsar's grpc 
version is, is my understanding correct?

##########
File path: flink-connectors/flink-connector-pulsar/pom.xml
##########
@@ -138,23 +140,60 @@ under the License.
                        <version>${pulsar.version}</version>
                        <scope>test</scope>
                </dependency>
+
                <!-- Pulsar use a newer commons-lang3 in broker. -->
                <!-- Bump the version only for testing. -->
                <dependency>
                        <groupId>org.apache.commons</groupId>
                        <artifactId>commons-lang3</artifactId>
-                       <version>${commons-lang3.version}</version>
+                       <version>${pulsar-commons-lang3.version}</version>
+                       <scope>test</scope>
+               </dependency>
+
+               <!-- Pulsar use a newer zookeeper in broker. -->
+               <!-- Bump the version only for testing. -->
+               <dependency>
+                       <groupId>org.apache.zookeeper</groupId>
+                       <artifactId>zookeeper</artifactId>
+                       <version>${pulsar-zookeeper.version}</version>
                        <scope>test</scope>
                </dependency>
 
                <!-- Add Pulsar 2.x as a dependency. -->
                <!-- Move this to button for avoiding class conflicts with 
pulsar-broker. -->
-
                <dependency>
                        <groupId>org.apache.pulsar</groupId>
                        <artifactId>pulsar-client-all</artifactId>
                        <version>${pulsar.version}</version>
                        <exclusions>
+                               <exclusion>
+                                       <groupId>com.sun.activation</groupId>

Review comment:
       Wondering why we need to exclude these dependencies ?

##########
File path: 
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigUtils.java
##########
@@ -94,6 +100,11 @@ private PulsarConfigUtils() {
     public static PulsarClient createClient(Configuration configuration) {
         ClientBuilder builder = PulsarClient.builder();
 
+        // requestTimeoutMs don't have a setter method on ClientBuilder. We 
have to use low level
+        // setter method instead. So we put this at the beginning of the 
builder.
+        Integer requestTimeoutMs = 
configuration.get(PULSAR_REQUEST_TIMEOUT_MS);
+        builder.loadConf(singletonMap("requestTimeoutMs", requestTimeoutMs));

Review comment:
       nit: just a reminder to add this to doc (if not already ~ 

##########
File path: 
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/PulsarSink.java
##########
@@ -0,0 +1,121 @@
+/*
+ * 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.sink;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.connector.sink.Committer;
+import org.apache.flink.api.connector.sink.GlobalCommitter;
+import org.apache.flink.api.connector.sink.Sink;
+import org.apache.flink.api.connector.sink.SinkWriter;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.connector.base.DeliveryGuarantee;
+import org.apache.flink.connector.pulsar.sink.committer.PulsarCommitter;
+import org.apache.flink.connector.pulsar.sink.writer.PulsarWriter;
+import org.apache.flink.connector.pulsar.sink.writer.PulsarWriterState;
+import 
org.apache.flink.connector.pulsar.sink.writer.PulsarWriterStateSerializer;
+import 
org.apache.flink.connector.pulsar.sink.writer.selector.PartitionSelector;
+import org.apache.flink.connector.pulsar.sink.writer.selector.TopicSelector;
+import 
org.apache.flink.connector.pulsar.sink.writer.serializer.PulsarSerializationSchema;
+import org.apache.flink.core.io.SimpleVersionedSerializer;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * a pulsar Sink implement.
+ *
+ * @param <IN> record data type.
+ */
+@PublicEvolving
+public class PulsarSink<IN> implements Sink<IN, PulsarSinkCommittable, 
PulsarWriterState, Void> {
+
+    private final DeliveryGuarantee deliveryGuarantee;
+
+    private final TopicSelector<IN> topicSelector;
+    private final PulsarSerializationSchema<IN, ?> serializationSchema;
+    private final PartitionSelector<IN> partitionSelector;
+
+    private final Configuration configuration;
+
+    public PulsarSink(
+            DeliveryGuarantee deliveryGuarantee,
+            TopicSelector<IN> topicSelector,
+            PulsarSerializationSchema<IN, ?> serializationSchema,
+            PartitionSelector<IN> partitionSelector,
+            Configuration configuration) {
+        this.deliveryGuarantee = deliveryGuarantee;
+        this.topicSelector = topicSelector;
+        this.serializationSchema = serializationSchema;
+        this.partitionSelector = partitionSelector;
+        this.configuration = configuration;
+    }
+
+    /**
+     * Get a PulsarSinkBuilder to builder a {@link PulsarSink}.
+     *
+     * @return a Pulsar sink builder.
+     */
+    @SuppressWarnings("java:S4977")

Review comment:
       Would you mind provide more context why we have this @SuppressWarnings 
annotation

##########
File path: flink-connectors/flink-connector-pulsar/pom.xml
##########
@@ -163,13 +202,22 @@ under the License.
                </dependency>
        </dependencies>
 
-       <!-- gRPC use version range which don't support by flink ci. -->
        <dependencyManagement>
                <dependencies>
+                       <!-- Pulsar use higher gRPC version. -->
                        <dependency>
                                <groupId>io.grpc</groupId>
                                <artifactId>grpc-bom</artifactId>
-                               <version>${grpc.version}</version>
+                               <version>${pulsar-grpc.version}</version>
+                               <type>pom</type>
+                               <scope>import</scope>
+                       </dependency>
+
+                       <!-- Pulsar use higher netty version. -->
+                       <dependency>
+                               <groupId>io.netty</groupId>
+                               <artifactId>netty-bom</artifactId>
+                               <version>${pulsar-netty.version}</version>

Review comment:
       For dependencies, wondering have we tested there is no obvious runtime 
class issues ?

##########
File path: flink-connectors/flink-connector-pulsar/pom.xml
##########
@@ -36,12 +36,14 @@ under the License.
        <packaging>jar</packaging>
 
        <properties>
-               <pulsar.version>2.8.0</pulsar.version>
+               <pulsar.version>2.9.1</pulsar.version>
 
                <!-- Test Libraries -->
                
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
-               <commons-lang3.version>3.11</commons-lang3.version>
-               <grpc.version>1.33.0</grpc.version>
+               
<pulsar-commons-lang3.version>3.11</pulsar-commons-lang3.version>
+               <pulsar-zookeeper.version>3.6.3</pulsar-zookeeper.version>

Review comment:
       Are Netty and zookeepers used in test only ?

##########
File path: flink-connectors/flink-connector-pulsar/pom.xml
##########
@@ -36,12 +36,14 @@ under the License.
        <packaging>jar</packaging>
 
        <properties>
-               <pulsar.version>2.8.0</pulsar.version>
+               <pulsar.version>2.9.1</pulsar.version>

Review comment:
       nit:  Once sink and source are completed, we can document the pulsar 
versions

##########
File path: 
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/common/config/PulsarConfigValidator.java
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.config;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.Configuration;
+
+import org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList;
+import org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableSet;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+
+/**
+ * A config validator for {@link PulsarConfigBuilder}, used for validation of 
source & sink builder.
+ *
+ * <p>We would validate:
+ *
+ * <ul>
+ *   <li>If user have provided the required client config options.
+ *   <li>If user have provided some conflict options.
+ * </ul>
+ */
+@Internal
+public class PulsarConfigValidator {

Review comment:
       This class looks ok to me. Would be nice to have some basic test case 
for it ~ 




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to