[ 
https://issues.apache.org/jira/browse/KAFKA-6806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16446116#comment-16446116
 ] 

Randall Hauch commented on KAFKA-6806:
--------------------------------------

I think the problematic line is at 
https://github.com/apache/kafka/blob/1.1.0/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java#L264,
 which throws the exception inappropriately. Instead, later on in that method 
we're calling "validate" on the connector config and returning the response, 
and we need the validation error to be added to the {{Map<String, 
ConfigValue>}}.

Ideally we could just use a Validator to do the validation on the {{topic}} and 
{{topic.regex}} ConfigDef instances. Unfortunately, {{Validator.validate(...)}} 
doesn't let a ConfigDef know any other values other than its own.

Perhaps it makes sense to move the call to 
{{SinkConnectorConfig.validate(connectorProps)}} into the 
[validateBasicConnectorConfig(...) 
method|https://github.com/apache/kafka/blob/1.1.0/connect/runtime/src/main/java/org/apache/kafka/connect/runtime/AbstractHerder.java#L243]
 instead. It could check the type of connector, call 
{{SinkConnectorConfig.validate(connectorProps)}} and pass into that method the 
{{Map<String, ConfigValue>}} so it could add ConfigValue for `topic` and/or 
`topic.regex`.

However, I'm not sure how clean that is.

> Unable to validate sink connectors without "topics" component which is not 
> required
> -----------------------------------------------------------------------------------
>
>                 Key: KAFKA-6806
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6806
>             Project: Kafka
>          Issue Type: Bug
>          Components: KafkaConnect
>    Affects Versions: 1.1.0
>         Environment: CP4.1., Centos7
>            Reporter: Ivan Majnarić
>            Priority: Blocker
>             Fix For: 1.2.0, 1.1.1
>
>
> The bug is happening when you try to create new connector through for example 
> kafka-connect-ui.
> While both source and sink connectors were able to be validated through REST 
> without "topics" as add-on with "connector.class" like this:
> {code:java}
> PUT / 
> http://connect-url:8083/connector-plugins/com.datamountaineer.streamreactor.connect.cassandra.sink.CassandraSinkConnector/config/validate
> {
>     "connector.class": 
> "com.datamountaineer.streamreactor.connect.cassandra.sink.CassandraSinkConnector",
> }{code}
> In the new version of CP4.1 you still can validate *source connectors* but 
> not *sink connectors*. If you want to validate sink connectors you need to 
> add to request -> "topics" config, like:
> {code:java}
> PUT / 
> http://connect-url:8083/connector-plugins/com.datamountaineer.streamreactor.connect.cassandra.sink.CassandraSinkConnector/config/validate
> {
>     "connector.class": 
> "com.datamountaineer.streamreactor.connect.cassandra.sink.CassandraSinkConnector",
>     "topics": "test-topic"
> }{code}
> So there is a little missmatch of the ways how to validate connectors which I 
> think happened accidentally.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to