Docs Menu

Docs HomeMongoDB Kafka Connector

Converters

On this page

  • Overview
  • Available Converters
  • Converters with Schemas
  • Connector Configuration
  • Avro Converter
  • Protobuf Converter
  • JSON Schema Converter
  • JSON Converter
  • String Converter (Raw JSON)

This guide describes how to use converters with the MongoDB Kafka Connector. Converters are programs that translate between bytes and Kafka Connect's runtime data format.

Converters pass data between Kafka Connect and Apache Kafka. The MongoDB Kafka Connector passes data between MongoDB and Kafka Connect. The following diagram shows these relationships:

Diagram illustrating converters' role in Kafka Connect

To learn more about converters, see the following resources:

As the MongoDB Kafka Connector converts your MongoDB data into Kafka Connect's runtime data format, the MongoDB Kafka Connector works with all available converters.

Important

Use the Same Converter for your Source and Sink Connectors

You must use the same converter in your source and sink connectors. For example, if your source connector writes to a topic using Protobuf, your sink connector must use Protobuf to read from the topic.

To learn what converter to use, see this page from Confluent.

If you use a schema-based converter such as the converter for Avro, Protobuf, or JSON Schema, you should define a schema in your MongoDB Kafka Connector source connector.

To learn how to specify a schema, see the Apply Schemas guide.

This section provides templates for properties files to configure the following converters in a MongoDB Kafka Connector pipeline:

Click the following tabs to view properties files that work with the Avro converter:

To use the preceding properties file, replace the placeholder text in angle brackets with your information.

Click the following tabs to view properties files that work with the Protobuf converter:

To use the preceding properties file, replace the placeholder text in angle brackets with your information.

Click the following tabs to view properties files that work with the JSON Schema converter:

To use the preceding properties file, replace the placeholder text in angle brackets with your information.

Click the following tabs to view properties files that work with the JSON converter:

To use the preceding properties file, replace the placeholder text in angle brackets with your information.

Click the following tabs to view properties files that work with the String converter:

To use the preceding properties file, replace the placeholder text in angle brackets with your information.

←  Data FormatsSink Connector →