{
  "name": "jdbc-source-orders",

  "config": {
    "_doc": "JDBC Source - 增量按 (timestamp + incrementing) 拉取 MySQL shop 库",

    "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
    "tasks.max": "3",

    "_connection_doc": "JDBC URL / 用户 / 密码（生产建议放 Vault 用 ConfigProvider 注入）",
    "connection.url": "jdbc:mysql://mysql:3306/shop?useSSL=false&serverTimezone=UTC",
    "connection.user": "kafka",
    "connection.password": "kafka-secret-CHANGE-ME",

    "_table_doc": "白名单：仅同步 orders 和 users 两张表",
    "table.whitelist": "orders,users",
    "catalog.pattern": "shop",

    "_mode_doc": "复合模式：先按 updated_at 时间戳拉新，相同 updated_at 时按 id 兜底",
    "mode": "timestamp+incrementing",
    "timestamp.column.name": "updated_at",
    "incrementing.column.name": "id",

    "_topic_doc": "topic 名 = topic.prefix + 表名，如 mysql.shop.orders",
    "topic.prefix": "mysql.shop.",

    "_pace_doc": "每 5s 轮询一次源数据库；单批最多 1000 行",
    "poll.interval.ms": "5000",
    "batch.max.rows": "1000",

    "_dq_doc": "Schema 模式（建议 +Schema Registry + AvroConverter）",
    "numeric.mapping": "best_fit",
    "validate.non.null": "false",

    "_converter_doc": "本 Connector 单独覆盖 Worker 默认 Converter",
    "key.converter": "org.apache.kafka.connect.storage.StringConverter",
    "value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schemas.enable": "false",

    "_smt_doc": "用 ValueToKey 把 id 字段提到 key，让下游 Sink 按主键幂等",
    "transforms": "createKey,extractInt",
    "transforms.createKey.type": "org.apache.kafka.connect.transforms.ValueToKey",
    "transforms.createKey.fields": "id",
    "transforms.extractInt.type": "org.apache.kafka.connect.transforms.ExtractField$Key",
    "transforms.extractInt.field": "id",

    "_error_doc": "至少容忍 schema 错误，进 DLQ；其它错误（如 SQL 异常）仍 fail",
    "errors.tolerance": "all",
    "errors.log.enable": "true",
    "errors.log.include.messages": "true",
    "errors.deadletterqueue.topic.name": "dlq.jdbc-source-orders",
    "errors.deadletterqueue.topic.replication.factor": "3",
    "errors.deadletterqueue.context.headers.enable": "true"
  }
}
