forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Pulsar IO][Issue 5633]Support avro schema for debezium connector (ap…
…ache#6034) Fixes apache#5633 ### Motivation Currently, some users want to support Avro schema in debezium, so this pr supports this feature. For Kafka's Avro schema, it depends on the Avro 1.8 version, but Avro version has just been upgraded to 1.9 in pulsar, so shade is needed to avoid finding `addProp` function ### Modifications * Add a package `kafka-connect-avro-converter-shaded` * Add class KafkaSchema to converter Kafka's Avro schema to pulsar's schema ### Verifying this change Unit test and integration tests
- Loading branch information
Showing
21 changed files
with
645 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?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. | ||
--> | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>pulsar</artifactId> | ||
<groupId>org.apache.pulsar</groupId> | ||
<version>2.6.0-SNAPSHOT</version> | ||
<relativePath>..</relativePath> | ||
</parent> | ||
|
||
<artifactId>kafka-connect-avro-converter-shaded</artifactId> | ||
<name>Apache Pulsar :: Kafka Connect Avro Converter shaded</name> | ||
|
||
<dependencies> | ||
<!-- confluent connect avro converter --> | ||
<dependency> | ||
<groupId>io.confluent</groupId> | ||
<artifactId>kafka-connect-avro-converter</artifactId> | ||
<version>${confluent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-core-asl</artifactId> | ||
<version>${kafka-avro-convert-jackson.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-mapper-asl</artifactId> | ||
<version>${kafka-avro-convert-jackson.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<createDependencyReducedPom>true</createDependencyReducedPom> | ||
<promoteTransitiveDependencies>true</promoteTransitiveDependencies> | ||
|
||
<artifactSet> | ||
<includes> | ||
<include>io.confluent:*</include> | ||
<include>io.confluent:kafka-avro-serializer</include> | ||
<include>io.confluent:kafka-schema-registry-client</include> | ||
<include>io.confluent:common-config</include> | ||
<include>io.confluent:common-utils</include> | ||
<include>org.apache.avro:*</include> | ||
|
||
<include>org.codehaus.jackson:jackson-core-asl</include> | ||
<include>org.codehaus.jackson:jackson-mapper-asl</include> | ||
<include>com.thoughtworks.paranamer:paranamer</include> | ||
<include>org.xerial.snappy:snappy-java</include> | ||
<include>org.apache.commons:commons-compress</include> | ||
<include>org.tukaani:xz</include> | ||
</includes> | ||
</artifactSet> | ||
<relocations> | ||
<relocation> | ||
<pattern>io.confluent</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.io.confluent</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.apache.avro</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.avro</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.codehaus.jackson</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.org.codehaus.jackson</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>com.thoughtworks.paranamer</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.com.thoughtworks.paranamer</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.xerial.snappy</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.org.xerial.snappy</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.apache.commons</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.org.apache.commons</shadedPattern> | ||
</relocation> | ||
<relocation> | ||
<pattern>org.tukaani</pattern> | ||
<shadedPattern>org.apache.pulsar.kafka.shade.org.tukaani</shadedPattern> | ||
</relocation> | ||
</relocations> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" /> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer" /> | ||
</transformers> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
pulsar-functions/api-java/src/main/java/org/apache/pulsar/functions/api/KVRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* 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.pulsar.functions.api; | ||
|
||
import org.apache.pulsar.client.api.Schema; | ||
import org.apache.pulsar.common.schema.KeyValueEncodingType; | ||
|
||
/** | ||
* key value schema record. | ||
*/ | ||
public interface KVRecord<K, V> extends Record { | ||
|
||
Schema<K> getKeySchema(); | ||
|
||
Schema<V> getValueSchema(); | ||
|
||
KeyValueEncodingType getKeyValueEncodingType(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.