I try to create plugin with "transform" for my data to kafka-connect and use it with different sink connectors. When I install plugin, kafka-connect doesn't see my classes.
I used kafka-connect maven plugin to create my bundle zip. Installation with confluent-hub (from local file) has succeed.
All file are unzip, my worker properties has updated plugin.paths. I run my connect in distributed mode and try to create new connector with transformer from my package.
My plugin structure looks like:
- mwojdowski-my-connect-plugin-0.0.1-SNAPSHOT
|- manifest.json
|- lib
||- my-connect-plugin-0.0.1-SNAPSHOT.jar
and my manifest.json file:
{
"name" : "my-connect-plugin",
"version" : "0.0.1-SNAPSHOT",
"title" : "my-connect-plugin",
"description" : "A set of transformations for Kafka Connect",
"owner" : {
"username" : "mwojdowski",
"name" : "Marcin Wojdowski<mwojdowski@gmail.com>"
},
"tags" : [ "transform", "field", "topic" ],
"features" : {
"supported_encodings" : [ "any" ],
"single_message_transforms" : true,
"confluent_control_center_integration" : true,
"kafka_connect_api" : true
},
"documentation_url" : "",
"docker_image" : { },
"license" : [ {
"name" : "Confluent Software License",
"url" : "https://www.confluent.io/software-evaluation-license"
} ],
"component_types" : [ "transform" ],
"release_date" : "2019-08-29"
}
Next, I try to create new connector:
curl -XPOST -H 'Content-type:application/json' 'localhost:8083/connectors' -d '{
"name" : "custom-file-sink-with-validation",
"config" : {
"connector.class" : "FileStreamSink",
"tasks.max" : "1",
"topics" : "test_topic",
"file" : "/tmp/my-plugin-test.txt",
"key.ignore" : "true",
"schema.ignore" : "true",
"drop.invalid.message": "false",
"behavior.on.malformed.documents": "warn",
"key.converter":"org.apache.kafka.connect.storage.StringConverter",
"value.converter":"org.apache.kafka.connect.storage.StringConverter",
"transforms" : "Validation",
"transforms.Validation.type" : "org.kafka.connect.my.connector.ValidateId"
}
}'
After restart of kafka connect, when I try to create new connector, exception is thrown:
{
"error_code": 400,
"message": "Connector configuration is invalid and contains the following 2 error(s):\nInvalid value org.kafka.connect.my.connector.ValidateId for configuration transforms.Validation.type: Class org.kafka.connect.my.connector.ValidateId could not be found.\nInvalid value null for configuration transforms.Validation.type: Not a Transformation\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
}
I try to install plugin also manually, following doc: https://docs.confluent.io/current/connect/managing/install.html
But it looks, like Connect doesn't load my jars.
When I copy my jar to share/java/kafka it works, but this is not a solution.
I suspect my plugin is skip, because it not contains connectors. In this case should I add my jars to classpath manually? (Opposite to https://docs.confluent.io/current/connect/userguide.html#installing-plugins)
Or should I explicitly point in my connector configuration to try use my plugin?
Regards, M.