我是Kafka的新手,我不知道如何使用“transforms.router.type”使它与我的debezium设置一起工作。所以我做了一个特殊的事件转换java类,并预先进行了配置,以便将其部署到容器中,如下所示:
curl -x柱-h“accept:application/json“-h”内容-type:application/json" localhost:8083/connectors/ -d级
{
"name": "task-connector",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"slot.name" : "task_engine_saga",
"database.hostname": "postgres",
"database.port": "5432",
"database.user": "postgres",
"database.password": "postgres",
"database.dbname" : "tasks",
"schema.whitelist": "public",
"table.whitelist" : "public.task",
"tombstones.on.delete" : "false",
"transforms" : "router",
"transforms.router.type" : "com.task.connect.TaskEventRouter"
}
}
回复说找不到这个配置。
CREATE kafka connector task-connector....
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1091 100 516 100 575 8322 9274 --:--:-- --:--:-- --:--:-- 17596{"error_code":400,"message":"Connector configuration is invalid and contains the following 3 error(s):\nInvalid value com.task.connect.TaskEventRouter for configuration transforms.router.type: Class com.task.connect.TaskEventRouter could not be found.\nInvalid value null for configuration transforms.router.type: Not a Transformation\nA value is required\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"}
然后我复制到container/connect目录下我的主机文件夹和jar文件,在其中我有一个带有事件转换逻辑的java类,但它也没有帮助。有人能帮我,告诉我该怎么做,使这个自定义transforms.router.type与我的debezium设置工作?
我的容器docker compose设置:
version: '3'
services:
pgadmin:
container_name: pgadmin_container
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
volumes:
- pgadmin:/root/.pgadmin
ports:
- "${PGADMIN_PORT:-5050}:80"
restart: unless-stopped
zookeeper:
image: debezium/zookeeper:1.3
ports:
- 2181:2181
- 2888:2888
- 3888:3888
kafka:
image: debezium/kafka:1.3
ports:
- 9092:9092
links:
- zookeeper
environment:
- ZOOKEEPER_CONNECT=zookeeper:2181
postgres:
image: debezium/example-postgres:1.3
ports:
- 5432:5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- PGDATA=/data/postgres
- POSTGRES_DB=${POSTGRES_DB:-task_engine}
connect:
image: debezium/connect:1.3
ports:
- 8083:8083
links:
- kafka
- postgres
environment:
- BOOTSTRAP_SERVERS=kafka:9092
- GROUP_ID=1
- CONFIG_STORAGE_TOPIC=my_connect_configs
- OFFSET_STORAGE_TOPIC=my_connect_offsets
- STATUS_STORAGE_TOPIC=my_connect_statuses
volumes:
postgres:
pgadmin:
1条答案
按热度按时间z4bn682m1#
我在java类中做了特殊事件转换
据我所知,您没有将这个编译过的类装入debezium映像或编辑
plugin.path
包含该jar的文件如果您已经用这些数据创建了自己的docker映像,那么您应该进行更改
image: debezium/connect:1.3
这可以解释为什么转换不可用