Kafka REST API 带身份验证的源连接器 header
Kafka REST API source connector with authentication header
我需要使用 Header 身份验证为 REST API 创建 kafka 源连接器,例如
curl -H "Authorization: Basic " -H "clientID: " "https:< url for source> " 。
我正在使用 apache kafka ,我使用了连接器 class com.github.castorm.kafka.connect.http.HttpSourceConnector
这是我的 json 连接器
文件
{
"name": "rest_data6",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.github.castorm.kafka.connect.http.HttpSourceConnector",
"tasks.max": "1",
"http.request.headers": "Authorization: Basic <key1>",
"http.request.headers": "clientID: <key>",
"http.request.url": "https:<url for source ?",
"kafka.topic": "mysqltopic2"
}
}
我也试过“connector.class”:“com.tm.kafka.connect.rest.RestSourceConnector”,我的 joson 文件如下
"name": "rest_data2",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.tm.kafka.connect.rest.RestSourceConnector",
"rest.source.poll.interval.ms": "900",
"rest.source.method": "GET",
"rest.source.url":"URL of source ",
"tasks.max": "1",
"rest.source.headers": "Authorization: Basic <key> , clientId :<key2>",
"rest.source.topic.selector": "com.tm.kafka.connect.rest.selector.SimpleTopicSelector",
"rest.source.destination.topics": "mysql1"
}
}
但没有希望。知道如何通过身份验证获取 REST API 数据。我的身份验证参数是
授权:基本和授权:基本.
仅需提及两个文件都使用 REST API 无需身份验证,一旦我添加了身份验证参数,wither 连接器状态为失败或它产生“:”无法路由。 Codebase/company 主题中的“”消息无效。
任何人都可以建议解决它的方法
我将原始开发人员邮寄给了 Cástor Rodríguez。根据他的解决方案,我修改了 json
将页眉放入单一表单中并且有效
{
"name": "rest_data6",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.github.castorm.kafka.connect.http.HttpSourceConnector",
"tasks.max": "1",
"http.request.headers": "Authorization: Basic <key1>, clientID: <key>"
"http.request.url": "https:<url for source ?",
"kafka.topic": "mysqltopic2"
}
}
我需要使用 Header 身份验证为 REST API 创建 kafka 源连接器,例如 curl -H "Authorization: Basic " -H "clientID: " "https:< url for source> " 。 我正在使用 apache kafka ,我使用了连接器 class com.github.castorm.kafka.connect.http.HttpSourceConnector 这是我的 json 连接器
文件{
"name": "rest_data6",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.github.castorm.kafka.connect.http.HttpSourceConnector",
"tasks.max": "1",
"http.request.headers": "Authorization: Basic <key1>",
"http.request.headers": "clientID: <key>",
"http.request.url": "https:<url for source ?",
"kafka.topic": "mysqltopic2"
}
}
我也试过“connector.class”:“com.tm.kafka.connect.rest.RestSourceConnector”,我的 joson 文件如下
"name": "rest_data2",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.tm.kafka.connect.rest.RestSourceConnector",
"rest.source.poll.interval.ms": "900",
"rest.source.method": "GET",
"rest.source.url":"URL of source ",
"tasks.max": "1",
"rest.source.headers": "Authorization: Basic <key> , clientId :<key2>",
"rest.source.topic.selector": "com.tm.kafka.connect.rest.selector.SimpleTopicSelector",
"rest.source.destination.topics": "mysql1"
}
}
但没有希望。知道如何通过身份验证获取 REST API 数据。我的身份验证参数是 授权:基本和授权:基本.
仅需提及两个文件都使用 REST API 无需身份验证,一旦我添加了身份验证参数,wither 连接器状态为失败或它产生“:”无法路由。 Codebase/company 主题中的“”消息无效。 任何人都可以建议解决它的方法
我将原始开发人员邮寄给了 Cástor Rodríguez。根据他的解决方案,我修改了 json
将页眉放入单一表单中并且有效
{
"name": "rest_data6",
"config": {
"key.converter":"org.apache.kafka.connect.json.JsonConverter",
"value.converter":"org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable":"true",
"value.converter.schemas.enable":"true",
"connector.class": "com.github.castorm.kafka.connect.http.HttpSourceConnector",
"tasks.max": "1",
"http.request.headers": "Authorization: Basic <key1>, clientID: <key>"
"http.request.url": "https:<url for source ?",
"kafka.topic": "mysqltopic2"
}
}