Kafka Connect Reference Guide

Configuration using the REST API

To configure the Privacy Platform plug-in using the REST API, follow the procedure below:

  1. Make sure the Connector is properly installed on Kafka Connect by running:

    curl -X GET http://localhost:8083/connector-plugins/

    you should get back a list of connectors including both platform plug-ins:

    {"class":"com.privitar.agrotera.dataflow.kafka.PrivitarSinkConnector","type":"sink","version":"3.2.0"}, ...]
    {"class":"com.privitar.agrotera.dataflow.kafka.UnmaskPrivitarSinkConnector","type":"sink","version":"3.2.0"}, ...]
  2. Create a file configuration.json file with your connector configuration for each plug-in. The example below shows the configuration for the PrivitarSinkConnector plug-in:

    {
    "connector.class": "com.privitar.agrotera.dataflow.kafka.PrivitarSinkConnector",
    "tasks.max": "2",
    "topics": "my-topic",
    "privitar.publisherUrl": "https://localhost:8080",
    "privitar.publisherUsername": "api_user",
    "privitar.publisherPassword": "password",
    "value.privitar.enabled": true,
    "value.privitar.jobId": "8ebd",
    "value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "value.converter.schemas.enable": false,
    "dest.value.converter": "org.apache.kafka.connect.json.JsonConverter",
    "dest.value.converter.schemas.enable": false,
    "dest.bootstrap.servers": "localhost:9092",
    "dest.topics": "my-destination-topic"
    }

    For more information on the configuration settings, see Configuration options.

  3. Submit your new Connector to Kafka Connect:

    curl -X GET http://localhost:8083/connectors/MyConnectorName/status

    The response will show you if the Connector has actually started:

    {
        "name": "MyConnectorName",
        "connector": {
            "state": "RUNNING",
            "worker_id": "connect:8083"
        },
        "tasks": [
            {
                "state": "RUNNING",
                "id": 0,
                "worker_id": "connect:8083"
            },
            {
                "state": "RUNNING",
                "id": 1,
                "worker_id": "connect:8083"
            }
        ],
        "type": "sink"
    }

    Finally, check the Kafka Connect logs where the plug-in is running. (The location depends on configuration. For example, stdout).