Skip to content

Commit

Permalink
[Functions]Support protobuf schema for pulsar function (apache#11709)
Browse files Browse the repository at this point in the history
### Motivation

Some users have encountered the following exception when using the protobuf schema, so add the relevant dependencies to the instance:

```
ERROR org.apache.pulsar.functions.instance.JavaInstanceRunnable - Sink open produced uncaught exception:
java.lang.IllegalArgumentException: com.google.protobuf.GeneratedMessageV3 is not assignable from bold.proto.PersonOuterClass$Person
	at org.apache.pulsar.client.impl.schema.ProtobufSchema.of(ProtobufSchema.java:110) ~
```

### Modifications

* Add the relevant dependencies to the instance

### Verifying this change

- [x] Make sure that the change passes the CI checks.
  • Loading branch information
tuteng authored Aug 20, 2021
1 parent 061fb4b commit f893c08
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pulsar-functions/runtime-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@
<version>${jackson.databind.version}</version>
</dependency>

<!--In order to support protobuf schema, this dependency needs to be added-->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf3.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf3.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>

<!-- logging -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public void testInstanceJarDeps() throws IOException {
&& !name.startsWith("org/apache/avro")
&& !name.startsWith("com/fasterxml/jackson")
&& !name.startsWith("org/apache/commons/compress")
&& !name.startsWith("com/google")
&& !name.startsWith("org/checkerframework")
&& !name.startsWith("javax/annotation")
&& !name.startsWith("org/apache/logging/slf4j")
&& !name.startsWith("org/apache/logging/log4j")) {
notAllowedClasses.add(name);
Expand Down

0 comments on commit f893c08

Please sign in to comment.