You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/12/19 11:19:52 UTC

[pulsar] branch master updated: fix up pulsar-flink and flink-consumer-source (#3212)

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 8da04cb  fix up pulsar-flink and flink-consumer-source (#3212)
8da04cb is described below

commit 8da04cb883a586c605316cd7d5cf43b1009f037f
Author: wpl <12...@qq.com>
AuthorDate: Wed Dec 19 19:19:47 2018 +0800

    fix up pulsar-flink and flink-consumer-source (#3212)
    
    ### Motivation
    
    fix up flink-consumer-source example run error
    
    ### Modifications
    
    modify pom.xml, sl4j and log4j2
    
    ### Result
    
    1. log conflict, sl4j and log4j2
    2. flink-consumer-source example use pulsar-flink model class and api, cann't execution
    3. pulsar-flink not use jar but flink-consumer-source use, like flink-scala
---
 .gitignore                                         |  1 +
 examples/flink-consumer-source/pom.xml             | 33 ++++++++++++++-----
 .../src/main/resources/log4j2.xml                  | 37 ++++++++++++++++++++++
 pulsar-flink/pom.xml                               | 23 ++------------
 4 files changed, 65 insertions(+), 29 deletions(-)

diff --git a/.gitignore b/.gitignore
index d16fa61..bd3c93e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,5 +79,6 @@ docker.debug-info
 **/website/i18n/*
 **/website/translated_docs*
 
+# Avro
 examples/flink-consumer-source/src/main/java/org/apache/flink/batch/connectors/pulsar/avro/generated
 pulsar-flink/src/test/java/org/apache/flink/batch/connectors/pulsar/avro/generated
diff --git a/examples/flink-consumer-source/pom.xml b/examples/flink-consumer-source/pom.xml
index 0cea049..3c08697 100644
--- a/examples/flink-consumer-source/pom.xml
+++ b/examples/flink-consumer-source/pom.xml
@@ -19,7 +19,7 @@
 
 -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.pulsar.examples</groupId>
@@ -31,22 +31,39 @@
   <artifactId>flink-consumer-source</artifactId>
   <name>Pulsar Examples :: Flink Consumer Source</name>
 
+  <properties>
+    <log4j2.version>2.10.0</log4j2.version>
+  </properties>
+
   <dependencies>
     <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-slf4j-impl</artifactId>
+      <version>${log4j2.version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.apache.flink</groupId>
-      <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
+      <artifactId>flink-scala_${scala.binary.version}</artifactId>
       <version>${flink.version}</version>
     </dependency>
+
     <dependency>
       <groupId>org.apache.pulsar</groupId>
       <artifactId>pulsar-flink</artifactId>
       <version>${project.version}</version>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.pulsar</groupId>
-          <artifactId>pulsar-client-original</artifactId>
-        </exclusion>
-      </exclusions>
     </dependency>
   </dependencies>
 
diff --git a/examples/flink-consumer-source/src/main/resources/log4j2.xml b/examples/flink-consumer-source/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..2fdc2d0
--- /dev/null
+++ b/examples/flink-consumer-source/src/main/resources/log4j2.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<Configuration status="INFO">
+    <Appenders>
+        <Console name="Console" target="SYSTEM_OUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t:%C@%L] %-5level %logger{36} - %msg%n" />
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="warn">
+            <AppenderRef ref="Console" />
+        </Root>
+        <Logger name="org.eclipse.jetty" level="info"/>
+        <Logger name="org.apache.pulsar" level="info"/>
+        <Logger name="org.apache.bookkeeper" level="info"/>
+        <Logger name="org.apache.kafka" level="info"/>
+    </Loggers>
+</Configuration>
diff --git a/pulsar-flink/pom.xml b/pulsar-flink/pom.xml
index f32ca81..c891005 100644
--- a/pulsar-flink/pom.xml
+++ b/pulsar-flink/pom.xml
@@ -19,8 +19,8 @@
 
 -->
 <project
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+        xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -34,12 +34,10 @@
   <name>Pulsar Flink Connectors</name>
 
   <dependencies>
-
     <dependency>
       <groupId>org.apache.flink</groupId>
       <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
       <version>${flink.version}</version>
-      <scope>provided</scope>
     </dependency>
 
     <dependency>
@@ -53,12 +51,6 @@
 
     <dependency>
       <groupId>org.apache.flink</groupId>
-      <artifactId>flink-scala_${scala.binary.version}</artifactId>
-      <version>${flink.version}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.flink</groupId>
       <artifactId>flink-avro</artifactId>
       <version>${flink.version}</version>
     </dependency>
@@ -86,14 +78,6 @@
 
     <dependency>
       <groupId>org.apache.flink</groupId>
-      <artifactId>flink-tests_${scala.binary.version}</artifactId>
-      <version>${flink.version}</version>
-      <scope>test</scope>
-      <type>test-jar</type>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.flink</groupId>
       <artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
       <version>${flink.version}</version>
       <type>test-jar</type>
@@ -113,9 +97,6 @@
       <version>3.20.0-GA</version>
       <scope>test</scope>
     </dependency>
-
-
-
   </dependencies>
 
   <build>