Datagen Source Connector for Confluent Cloud

The Confluent Cloud Datagen Source connector is used to generate mock data for development and testing. The connector supports Avro, JSON Schema, Protobuf, and JSON (schemaless) output formats. The mock source data is provided through GitHub from datagen resources. This connector is not suitable for production use.

Important

Confluent Cloud Enterprise customers must have a Confluent Cloud annual commitment to use this connector. Contact your Confluent Account Executive to learn more and to update your subscription, if necessary.

Quick Start

Use this quick start to get up and running with the Confluent Cloud Datagen source connector. The quick start provides the basics of selecting the connector and configuring it to use for testing and development. This connector is not suitable for production use.

Prerequisites
  • Kafka cluster credentials. You can use one of the following ways to get credentials:
    • Create a Confluent Cloud API key and secret. To create a key and secret, go to Kafka API keys in your cluster or you can autogenerate the API key and secret directly in the UI when setting up the connector.
    • Create a Confluent Cloud service account for the connector.

Using the Confluent Cloud GUI

Step 1: Launch your Confluent Cloud cluster.

See the Quick Start for Apache Kafka using Confluent Cloud for installation instructions.

Step 2: Add a connector.

Click Connectors. If you already have connectors in your cluster, click Add connector.

Step 3: Select your connector.

Click the Datagen Source connector icon.

Datagen Source Connector

Step 4: Set up the connection.

Complete the following and click Continue.

Note

  • Make sure you have all your prerequisites completed.
  • An asterisk ( * ) designates a required entry.
  1. Enter a connector name.
  2. Enter your Kafka Cluster credentials. The credentials are either the API key and secret or the service account API key and secret.
  3. Select a topic (or topics) where you want to send data.
  4. Select an output Message format (data coming from the connector): AVRO, JSON, JSON_SR (JSON Schema), or PROTOBUF. Schema Registry must be enabled to use a Schema Registry-based format (for example, Avro, JSON Schema, or Protobuf).
  5. Select one of the Quick start schemas that will generate sample data into the Kafka topic. The source schema specifications are listed on GitHub in datagen resources.
  6. Enter the maximum interval between messages (in milliseconds). The default interval value is 1000 ms. You can change the interval to a lower value to generate records more quickly.
  7. Enter the number of tasks for the connector.

Step 5: Launch the connector.

Verify the connection details and click Launch.

Launch the connector

Step 6: Check the connector status.

The status for the connector should go from Provisioning to Running. It may take a few minutes.

Check the connector status

Step 7: Check the Kafka topic.

After the connector is running, verify that messages are populating your Kafka topic.

Using the Confluent Cloud CLI

Complete the following steps to set up and run the connector using the Confluent Cloud CLI.

Note

Make sure you have all your prerequisites completed.

Step 1: List the available connectors.

Enter the following command to list available connectors:

ccloud connector-catalog list

Step 2: Show the required connector configuration properties.

Enter the following command to show the required connector properties:

ccloud connector-catalog describe <connector-catalog-name>

For example:

ccloud connector-catalog describe DatagenSource

Example output:

Following are the required configs:
connector.class: DatagenSource
name
kafka.api.key
kafka.api.secret
kafka.topic
output.data.format
quickstart
tasks.max

Step 3: Create the connector configuration file.

Create a JSON file that contains the connector configuration properties. The following example shows the required connector properties.

{
    "name" : "<datagen-connector-name",
    "connector.class": "DatagenSource",
    "kafka.api.key": "<my-kafka-api-key>",
    "kafka.api.secret" : "<my-kafka-api-secret",
    "kafka.topic" : "topic1, topic2",
    "output.data.format" : "JSON",
    "quickstart" : "PAGEVIEWS",
    "tasks.max" : "1"
}

Note the following property definitions:

  • "name": Sets a name for your new connector.

  • "connector.class": Identifies the connector plugin name.

  • "kafka.topic": Enter one topic or multiple comma-separated topics.

  • "output.data.format": Sets the output message format (data coming from the connector). Valid entries are AVRO, JSON_SR, PROTOBUF, or JSON (schemaless). You must have Confluent Cloud Schema Registry configured if using a schema-based output message format (for example, Avro).

  • "quickstart": Enter one of the following Quick Start schemas:

    • CLICKSTREAM
    • CLICSTREAM_CODES
    • CLICKSTREAM_USERS
    • INVENTORY
    • ORDERS
    • PAGEVIEWS (shown in the example)
    • PRODUCT
    • RATINGS
    • STOCK_TRADES
    • USERS
    • USERS_ARRAY

    To view the sample data and schema specifications, see datagen resources.

Step 4: Load the configuration file and create the connector.

Enter the following command to load the configuration and start the connector:

ccloud connector create --config <file-name>.json

For example:

ccloud connector create --config datagen-source-config.json

Example output:

Created connector confluent-datagen-source lcc-ix4dl

Step 5: Check the connector status.

Enter the following command to check the connector status:

ccloud connector list

Example output:

ID          |       Name               | Status  | Type
+-----------+--------------------------+---------+-------+
lcc-ix4dl   | confluent-datagen-source | RUNNING | source

Step 6: Check the Kafka topic.

After the connector is running, verify that messages are populating your Kafka topic.

Example

To see the Datagen Source Connector for Confluent Cloud in action, see the automated example in GitHub.

Next Steps

See also

For an example that shows fully-managed Confluent Cloud connectors in action with Confluent Cloud ksqlDB, see the Cloud ETL example. This example also shows how to use Confluent Cloud CLI to manage your resources in Confluent Cloud.

../../_images/topology.png