Kafka Connect is basically a set of connectors that allow you to get data from an external Database straight into Kafka, and to put your data from Kafka into any other external Data Sink/System. Simply put, Kafka Connectors help you simplify moving data in and out of Kafka. This article will take you through some of the best Kafka Connectors.

What is Kafka?

Kafka Connectors: Kafka

Apache Kafka is a popular Distributed Data Streaming software that allows for the development of real-time event-driven applications. Being an open-source application, Kafka allows you to store, read, and analyze streams of data free of cost. Kafka is distributed, which means that it can run as a Cluster that spans multiple servers. Leveraging its distributed nature, users can achieve high throughput, minimal latency, high computation power, etc., and can handle large volumes of data without any perceptible lag in performance.

Seamless Kafka Integration with Hevo

Hevo makes it easy to integrate Kafka with a no-code approach, allowing users to set up pipelines quickly. It automatically manages real-time streaming and data replication, ensuring a smooth data flow with minimal effort. Hevo’s intuitive platform simplifies Kafka connectivity without requiring extensive technical skills.

What Hevo Offers for Kafka Integration:

  • Schema Management: Hevo auto-detects and adjusts schema changes to ensure uninterrupted data flow.
  • No-Code Setup: Easily connect Kafka to your data warehouse or applications with a user-friendly interface.
  • Real-Time Streaming: Automatically sync Kafka data with low latency for real-time analytics and insights.
Get Started with Hevo for Free

What are Kafka Connectors?

Kafka Connectors are pluggable components responsible for interfacing with external Data Systems to facilitate data sharing between them and Kafka. They simplify the process of importing data from external systems to Kafka and exporting data from Kafka to external systems. Whether you want to pull data from external systems or push data to external systems, Kafka Connectors are here to share your load of moving data.

You can use existing Kafka Connectors for common Data Sources and Sinks or even implement your own connectors. A Source Connector is used to collect data from systems such as Databases, Stream Tables, Message Brokers, etc., and a Sink Connector is used to deliver data to Batch Systems, Indexes, or any kind of Database.

There’s a lot of connectors available to move data between Kafka and other popular Data Systems, such as S3, JDBC, Couchbase, S3, Golden Gate, Cassandra, MongoDB, Elasticsearch, Hadoop, and many more.

Types of Kafka Connectors

There are two types of Kafka Connectors, which are divided on the basis of their location.

Source and Sink Connectors

Based on the location of Connectors, they can be divided into two types:

  • Source Connectors: Source connectors are tools or services that log into data sources, which may be databases, APIs, or file systems, extract data, and stream it. They are designed for the earlier stages of data integration, allowing the movement of data from different origin points into the central system.
  • Sink Connectors: Sink connectors are tools or services that receive data from source connectors and load it into destination systems, such as a data warehouse, database, or analytics platform. They handle the last phase of data integration to ensure that it is properly stored and made available for analysis or reporting.

Here is the tabular difference between the two types of connectors for your better understanding.

AspectSource ConnectorsSink Connectors
PurposeIt is used to extract data from origin systemsIt is used to load data into the destination systems
Data FlowThe direction of data flow is from the origin to the connectorThe direction of data flow is from the connector to the destination system.
Key RoleIt is involved in the initial phase of data integrationIt is involved in the final phase of integration
TransformationIt may include preliminary data transformation or filteringIt often involves data formatting and final transformation for storage
Tabular Differences between Source and Sink

Key Features of Kafka Connect

Kafka Connect is basically a group of pre-built and even custom-built connectors using which you can transfer data from an exact Data Source to another exact Data Sink. Simply put, it is a framework for connecting Kafka to external systems using connectors. Take a look at some of the promising features of Kafka Connect.

  • It aids in the development, deployment, and management of Kafka Connectors, making it is easy to establish connections with external systems.
  • It comes with a REST interface allowing you to manage and control connectors using a REST API.
  • It is designed to be scalable and fault-tolerant, meaning you can deploy Kafka Connect not just as an individual process but also as a Cluster.
  • Kafka Connect automates the process of Offset Commit, which saves you the trouble of manually implementing this tedious and error-prone process.
  • Kafka Connect is an ideal solution for both streaming and batch data processing.

How to Setup Kafka Connect?

It’s very easy to get started with Kafka Connect. To get started, you can download the open-source edition of Confluent Platform (the parent company of Kafka). 

For the purpose of this demonstration, the most basic Connectors (the file Source Connector and the file Sink Connector) are used. You can easily find them on the Confluent Platform.

  • Source Connector Configuration
  • Sink Connector Configuration
  • Worker Configuration

Source Connector Configuration

For the Source Connector, you can find the reference configuration at $CONFLUENT_HOME/etc/kafka/connect-file-source.properties:

name=local-file-source
connector.class=FileStreamSource
tasks.max=1
topic=connect-test
file=test.txt

$CONFLUENT_HOME is the working directory.

Take a look at the Source Connector configuration parameters:

  • name is a name given by the user for the connector instance.
  • connector.class specifies the implementing class or the kind of connector.
  • tasks.max specifies the number of instances of Source Connector running in parallel.
  • topic defines the Topic to which the connector should send the output.
  • file is a connector-specific attribute that defines the file from which the connector should read the input.

Sink Connector Configuration

For the Sink Connector, you can find the reference configuration at $CONFLUENT_HOME/etc/kafka/connect-file-sink.properties:

name=local-file-sink
connector.class=FileStreamSink
tasks.max=1
file=test.sink.txt
topics=connect-test

The parameters are all exactly the same as discussed for the Source Connector, except for “connector.class” and “file”. Here, connector.class specifies the Sink Connector implementation class, and file is the file where the connector should write the content.

Worker Configuration

Connect Worker will integrate the two connectors and read from the Source Connector and write to the Sink Connector. You can find the reference Worker configuration at $CONFLUENT_HOME/etc/kafka/connect-standalone.properties:

bootstrap.servers=localhost:9092
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false
offset.storage.file.filename=/tmp/connect.offsets
offset.flush.interval.ms=10000
plugin.path=/share/java

plugin.path holds a list of paths where connector implementations are available. You can set plugin.path to $CONFLUENT_HOME/share/java.

Take a look at the worker configuration parameters:

  • bootstrap.servers holds the addresses of the Kafka brokers.
  • key.converter and value.converter define converter classes.
  • key.converter.schemas.enable and value.converter.schemas.enable are converter-specific settings.
  • offset.storage.file.filename defines where the Connector should store its offset data.
  • offset.flush.interval.ms defines the interval at which the Worker tries to commit offsets for tasks.

And with that, you can set up your first connector. However, Workers run in two modes: Standalone Mode and Distributed Mode. Before getting started, you must identify which mode would work best for your environment.

  • Standalone Mode is ideal for developing and testing Kafka Connect on a local machine. It can also be used for environments that typically use single agents.
  • Distributed Mode connects Workers on multiple machines (nodes) forming a Connect Cluster. It allows you to add or remove nodes as per your needs.

Top Kafka Connectors

Use Kafka Connectors to move data between Apache Kafka® and other external systems that you want to pull data from or push data to. You can download these popular connectors from Confluent Hub.

1) JDBC Source and Sink Connector

Kafka Connectors: JDBC

A JDBC Driver enables a Java application to interact with a Database. The Kafka Connect JDBC Source Connector is capable of importing data from any Relational Database with a JDBC Driver into a Kafka Topic. Similarly, the JDBC Sink Connector is capable of exporting data from Kafka Topics to any Relational Database with a JDBC Driver. 

Key Features

Let us discuss some of the key features of the JDBC Connector

  • Data Import and Export: The JDBC Source Connector is used to import data from relational databases to Kafka Topics using the JDBC Driver. Similarly, the Sink Connector is used to export data from Kakfa Topics to relational databases.
  • Wide Range of Compatibility: It can support a wide range of relational databases like MySQL and PostgreSQL if they have JDBC Drivers.
  • Customizable Configurations: It allows flexible configuration of the conditions under which data shall be extracted and loaded, including data filtering and transformation.

Pricing

The Kafka Connect JDBC connectors are available as open-source software, so there is no direct cost for the connectors themselves.

Pros

  • It offers real-time data integration and streaming, working very well in dynamic data environments.
  • It simplifies the process of integrating Kafka with relational databases, therefore reducing complexities.

Cons

  • If there are frequent changes in high volumes of data, performance can be impacted.
  • Initial setup and configuration may be complex, particularly for large-scale deployments. 
Integrate Kafka to Snowflake
Integrate Kafka to Redshift

2) Google BigQuery Sink Connector

Kafka Connectors: BigQuery

Google BigQuery Sink Connector is used to stream data into BigQuery Tables. The Sink Connector automatically creates BigQuery Tables while streaming data from Kafka Topics. The connector is highly scalable as it contains an internal thread pool capable of streaming records in parallel.

Key Features

Let us discuss some of its key features.

  • Data Export: It transfers data from Kafka topics directly into Google BigQuery tables, hence making the data integration and analytics smooth.
  • Auto Schema Management: It provides an automated mechanism for schema evolution and data type mapping between Kafka and BigQuery.
  • Real-time Data Streaming: It has the capability of real-time data ingestion from Kafka to BigQuery, thereby helping in real-time analytics.

Pricing

The Google BigQuery Sink Connector itself is open-source and available without direct cost. However, charges are associated with BigQuery’s pricing model.

Pros

  • It leverages BigQuery’s fully managed environment which reduces the effort of managing infrastructure manually.
  • It allows for real-time analytics and reporting, therefore improving the timeliness of business insights.

Cons

  • Even though it is designed for real-time streaming,  some latency will occur depending on the amount of data and system performance.
  • The tight integration it has with Google BigQuery might result in vendor lock-in and reduced flexibility in adopting other analytics platforms.

3) JMS Source Connector

Kafka Connectors: JMS

The JMS Source Connector is capable of moving messages from any JMS-compliant broker into a Kafka Topic. It supports all traditional JMS (Java Message Service) Brokers, such as IBM MQ, ActiveMQ, Solace Appliance, etc. It makes use of JNDI (Java Naming and Directory Interface) to connect to the JMS broker.

Key Features

  • Message Conversions: It automatically converts JMS message formats into Kafka-compatible ones, guaranteeing an easier flow of information.
  • Reliable Delivery: It ensures reliable delivery of your messages and also handles message acknowledgements and retries.
  • Configurations: It allows you to change message formats and parameters according to your needs.

Pricing

The JMS Source Connector is typically available as open-source software, so you do not need to pay to use it.

Pros

  • Works with a great variety of JMS providers such as ActiveMQ, IBM MQ, and RabbitMQ, hence providing flexibility in message sources.
  • It can handle high message throughput efficiently.

Cons

  • It might not fully leverage Kafka’s native features such as Kafka Streams or KSQL.
  • Message ingestion can introduce latency in real-time streaming.

4) Elasticsearch Service Sink Connector

Kafka Connectors: Elasticsearch

Elasticsearch is the world’s leading open-source search and analytics solution. The Kafka Connect Elasticsearch Service Sink Connector is capable of moving data from a Kafka to Elasticsearch. It writes data from Kafka Topic to an Elasticsearch Index. All data have the same type in Elasticsearch allowing independent evolution of schemas for data from different Kafka Topics.

Key Features

  • Bulk Indexing: It uses Elasticsearch’s bulk indexing to enable the system to handle vast amounts of data efficiently and ensure that performance is optimal.
  • Custom Mappings: It allows the configuration of custom field mappings and analyzers in order to tailor indexing and search capabilities for specific use cases.
  • Advanced Data Transformations: It allows advanced data transformation and enrichment before indexing to support customized data processing and indexing.

Pricing

The Elasticsearch Sink Connector itself is open-source and free to use. However, costs can be associated with ElasticSearch’s pricing model.

Pros

  • It allows for real-time indexing of data from Kafka for updated search results and analytics.
  • It facilitates complex querying and full-text searching over the ingested data, improving usability and gaining insights from the data.

Cons

  • It requires efficient handling and monitoring of errors, as there could be problems related to failures in data ingestion or indexing.
  • Costs can accumulate with large data volumes and high query frequencies.

5) Amazon S3 Sink Connector

Kafka Connectors: Amazon S3 Sink

As the name suggests, Amazon S3 Sink Connector exports data from Kafka Topics to Amazon S3 Objects in either Avro, JSON, or Bytes formats. In addition to Schema Records, this Kafka Connector is also capable of exporting plain JSON Records without schema in text files.

Key Features

  • File Formatting Options: It supports various file formats, such as JSON, Avro, and Parquet, to deal with different data processing requirements.
  • Batch Processing: It configures batch sizes and time intervals between data writes to optimize data transfer, reducing the overhead.
  • Partitioning: One of its added features is the ability to partition S3 buckets based on configuration—for instance, date or topic—which enhances data organization and retrieval.

Pricing

The Amazon S3 Sink Connector is open-source and available without direct cost for the connector itself.

Pros

  • It ensures that your data is highly reliable and protected against loss.
  • It supports S3 event notifications, allowing one to set up automated workflows or processing when new data has been uploaded to or changed in S3.

Cons

  • Costs associated with data retrieval and transfer out of S3 can add up to increase the total costs of export.
  • It might produce latency because of batch intervals and sizes, thus compromising either the timeliness of the data made available or the relevancy of the operations being performed on the data.

6) HDFS 2 Sink Connector

Kafka Connectors: HDFS

The HDFS 2 Sink Connector is capable of exporting data from any Kafka Topic to HDFS 2.x files in a variety of formats. The connector also integrates with Hive to make data readily available for querying with HiveQL. It supports exporting data to HDFS in Avro and Parquet format. In addition to that, you can also write other formats to HDFS by extending the Format class.

Key Features

  • Data Export to HDFS: It feeds data directly from Kafka topics to the Hadoop Distributed File System (HDFS), thus giving the ability to integrate with big data ecosystems.
  • Batch and Streaming Modes: It provides options for batch and streaming modes of data ingestion and, therefore, flexibility on how the data should be processed based on the needs.
  • Fault Tolerance: It has a mechanism to retry in case there is a writing failure. Therefore, it prevents your data from getting lost.

Pricing

The HDFS Sink Connector is open-source, and you do not need to pay to use it.

Pros

  • It leverages the scalable architecture of HDFS for the processing of vast amounts of data and the storage needs of data that is increasing.
  • Options related to files and partitioning allow the setting of data so that it is well-organized, thereby improving retrieval and management.

Cons

  • It requires a huge amount of resources to maintain an HDFS cluster and the Kafka infrastructure, which increases operational expenditures.
  • It can be difficult to troubleshoot, especially in the case of large datasets.

7) MySQL Source (Debezium) Connector

Kafka Connectors: MySQL Debezium

The Debezium MySQL Source Connector can read a snapshot of the existing data and record all of the row-level changes in the Databases on a MySQL Server or Cluster. However, Debezium MySQL Source Connector is capable of running only one task.

Key Features

  • Change Data Capture (CDC): It uses Debezium’s change data capture for streaming real-time changes from MySQL databases into Kafka topics.
  • Transactional Consistency: It ensures consistency of transactions by capturing changes and streaming, following ACID compliance to maintain integrity in data.
  • Reduces Latency: It helps to reduce latency between database changes and availability in Kafka.

Pricing

The MySQL Source Connector (Debezium) is open-source and available without direct cost.

Pros

  • It provides granular tracking of database changes, which can include inserts, updates, and deletes.
  • It easily decouples the data source MySQL from the data processing layer, which is Kafka.

Cons

  • It majorly relies on MySQL’s bin log, which can produce latency depending on the volume of changes.
  • The setup process can be complex.

8) Replicator

Replicator allows you to easily replicate Topics from one Kafka Cluster to another. Replicator is also capable of creating topics as needed, preserving the topic configuration in the Source Cluster. Although it replicates data within Kafka, it is still implemented as a connector.

Key Features

  • Cross-Cluster Compatibility: It is designed with a number of configurations that replicate Kafka clusters from on-premises to the cloud or even between different cloud providers.
  • Automatic Failover: It provides mechanisms for automatic failover and recovery in case of cluster failures, improving system reliability and uptime.

Pricing

Pricing is typically based on a subscription model or usage-based fees, which vary depending on the scale and features needed.

Pros

  • It makes a replica of data across clusters and hence provides redundancy, in turn providing fault tolerance.
  • It provides flexible configuration options to adapt replication processes to particular needs.

Cons

  • It is quite challenging to manage errors and maintain data consistency across clusters.
  • Replication may sometimes introduce latency.

Read More About: Connect Kafka to S3

Conclusion

Most developers consider Kafka Connect to be the natural choice for moving data in and out of Kafka. Without the need for additional resources, you can use Kafka Connectors to share data between Kafka Topics and other external Data Systems. In this tutorial, you were introduced to Kafka Connect and discussed some of the popular Kafka Connectors. However, in businesses, extracting complex data from a diverse set of Data Sources can be a challenging task and this is where Hevo saves the day!

Share your experience of working with Kafka Connectors in the comments section below.

FAQs about Kafka Connectors

1. What are connectors in API?

Connectors in the context of APIs are specialized components or tools that facilitate the integration and interaction between different software systems or applications.

2. Why do we need a Kafka connector?

We need Kafka connectors to seamlessly integrate Kafka with various data sources and sinks, enabling efficient real-time data streaming and processing across diverse systems.

3. What is the difference between Kafka connector and cluster?

A Kafka connector facilitates the integration and data flow between Kafka and external systems, such as databases or file systems, while a Kafka cluster is a group of Kafka brokers that work together to store and manage streaming data. 

Raj Verma
Business Analyst, Hevo Data

Raj, a data analyst with a knack for storytelling, empowers businesses with actionable insights. His experience, from Research Analyst at Hevo to Senior Executive at Disney+ Hotstar, translates complex marketing data into strategies that drive growth. Raj's Master's degree in Design Engineering fuels his problem-solving approach to data analysis.