Docs Menu

Docs HomeDevelop ApplicationsMongoDB 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 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 connector converts your MongoDB data into Kafka Connect's runtime data format, the 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 MongoDB Kafka source connector and MongoDB Kafka sink connector. 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 Kafka Connect Avro Converter (Avro Converter), Kafka Connect Protobuf Converter, or Kafka Connect JSON Schema Converter, you should define a schema in your 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 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 FormatsTutorials →