데이터베이스 소스 커넥터를 사용하여 Postgres 데이터베이스 테이블에서 Kafka 주제로 데이터를 이동하고 있습니다. customerNumber 필드를 사용하는 customers 테이블이있는 외래 키가있는 orders 테이블이 있습니다.
아래는 주문을 Kafka에 복사하지만 고객 데이터는 JSON으로 복사하지 않는 커넥터입니다. 고객과 함께 주문의 전체 개체를 JSON으로 구성하는 방법을 찾고 있습니다.
커넥터는 다음과 같습니다.
{
"name": "SOURCE_CONNECTOR",
"config": {
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"transforms.createKey.type": "org.apache.kafka.connect.transforms.ValueToKey",
"connection.password": "postgres_pwd",
"transforms.cast.type": "org.apache.kafka.connect.transforms.Cast$Value",
"transforms.cast.spec": "amount:float64",
"tasks.max": "1",
"transforms": "cast,createKey,extractInt",
"transforms.extractInt.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
"batch.max.rows": "25",
"table.whitelist": "orders",
"mode": "bulk",
"topic.prefix": "data_",
"transforms.extractInt.field": "uuid",
"connection.user": "postgres_user",
"transforms.createKey.fields": "uuid",
"poll.interval.ms": "3600000",
"sql.quote.identifiers": "false",
"name": "SOURCE_CONNECTOR",
"numeric.mapping": "best_fit",
"connection.url": "url"
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다