1
1
# kafka-connect-protobuf-converter
2
2
Converter plugin for [ Kafka Connect] ( https://docs.confluent.io/current/connect/ ) . A converter
3
- controls the format of the data that will be written to Kafka for source connectors or
3
+ controls the format of the data that will be written to Kafka for source connectors or
4
4
read from Kafka for sink connectors.
5
5
6
6
## Compatibility
@@ -11,15 +11,15 @@ The 2.x release series is compatible with Kafka Connect 5.x. and up (older relea
11
11
12
12
## Usage
13
13
14
- Copy the ` kafka-connect-protobuf-converter ` jar and the jar containing your compiled protocol buffers to
14
+ Copy the ` kafka-connect-protobuf-converter ` jar and the jar containing your compiled protocol buffers to
15
15
` /usr/share/java/kafka-serde-tools ` on your Kafka Connect instance and restart Kafka Connect.
16
16
17
17
Converters can be specified on a per-connector basis.
18
18
19
19
To use the protobuf converter in Kafka Connect, specify the converter as your key and value converter and specify the
20
20
protocol buffer class you want to use to deserialize the message (ex: ` com.google.protobuf.Int32Value ` ).
21
21
22
- Note: Nested classes must be specified using the ` $ ` notation, for example
22
+ Note: Nested classes must be specified using the ` $ ` notation, for example
23
23
` com.blueapron.connect.protobuf.NestedTestProtoOuterClass$NestedTestProto `
24
24
25
25
Example Kafka Connect JDBC source:
@@ -105,7 +105,7 @@ original name and keep the Kafka Connect schema consistent.
105
105
You can specify the name for this field option using the ` legacyName ` configuration item. By default, the field option
106
106
used is ` legacy_name `
107
107
108
- Example: ` value.converter.legacyName=legacy_name `
108
+ Example: ` value.converter.legacyName=blueapron.connect.protobuf. legacy_name `
109
109
110
110
This annotation provides a hint that allows renamed fields to be mapped to correctly to their output schema names.
111
111
@@ -127,7 +127,7 @@ import "path/to/LegacyName.proto";
127
127
128
128
message TestMessage {
129
129
string yet_another_named_string = 1 [(blueapron.connect.protobuf.legacy_name) = "test_string"];
130
- }
130
+ }
131
131
132
132
```
133
133
@@ -166,8 +166,8 @@ mvn test
166
166
mvn clean package
167
167
```
168
168
169
- Copy the JAR with dependencies (` kafka-connect-protobuf-converter-*-jar-with-dependencies.jar ` ) to
170
- ` /usr/share/java/kafka-serde-tools ` on your local Kafka Connect instance to make the
169
+ Copy the JAR with dependencies (` kafka-connect-protobuf-converter-*-jar-with-dependencies.jar ` ) to
170
+ ` /usr/share/java/kafka-serde-tools ` on your local Kafka Connect instance to make the
171
171
converter available in Kafka Connect.
172
172
173
173
#### Deploy to Maven Central:
@@ -194,3 +194,10 @@ converter available in Kafka Connect.
194
194
```
195
195
mvn release:perform
196
196
```
197
+
198
+ #### Generate protos:
199
+
200
+ Run the below command from the repository root.
201
+ ```
202
+ protoc -I=src/test/java/com/blueapron/connect/protobuf/protos --java_out=src/test/java/ src/test/java/com/blueapron/connect/protobuf/protos/*.proto
203
+ ```
0 commit comments