Linking Apache Ignite and Apache Kafka for Highly Scalable and Reliable Data Processing

DZone 's Guide to

Linking Apache Ignite and Apache Kafka for Highly Scalable and Reliable Data Processing

Here's how to link Apache Kafka and Ignite, for maintaining scalability and reliability for data processing. We'll explore injecting data with KafkaStreamer, as well as IgniteSinkConnector.

· Integration Zone ·
Free Resource

Apache Ignite is a "high-performance, integrated and distributed in-memory platform for computing and transacting on large-scale data sets in real-time, orders of magnitude faster than possible with traditional disk-based or flash-based technologies." It has a vast, mature and continuously growing arsenal of in-memory components to boost the performance and increase the scalability of applications. In addition, it provides a great number of integration solutions including integrations with Apache Spark and Hadoop, Apache Flume, Apache Camel, and others.

Both Apache Ignite and Apache Kafka are known for their high scalability and reliability, and in this article, I will describe how one can easily link it to Apache Kafka messaging system to achieve a robust data processing pipeline. I will present two solutions available out of the box: KafkaStreamer and IgniteSinkConnector, based on the recently released feature of Apache Kafka -- Kafka Connect.

Injecting Data via KafkaStreamer

Fetching data from Kafka and injecting it into Ignite for further in-memory processing became possible from Ignite 1.3 via its KafkaStreamer, which is an implementation of IgniteDataStreamer using Kafka's consumer to pull data from Kafka brokers and efficiently placing it into Ignite caches.

To use it, first of all, you will have to add KafkaStreamer dependency to the pom.xml


Assuming you have a cache with String keys and String values, data streaming can be done in a simple manner.

KafkaStreamer<String, String, String> kafkaStreamer = new KafkaStreamer<>();

try (IgniteDataStreamer<String, String> stmr = ignite.dataStreamer(null)) {
    // allow overwriting cache data


    // set the topic

    // set the number of threads to process Kafka streams

    // set Kafka consumer configurations

    // set decoders

finally {

For consumer configurations, you can refer Apache Kafka docs.

Injecting Data via IgniteSinkConnector

From the upcoming Apache Ignite release 1.6 yet another way to integrate your data processing becomes possible. It is based on Kafka Connect, a new feature introduced in Apache Kafka 0.9 that enables scalable and reliable streaming data between Apache Kafka and other data systems.
Such integration enables continuous and safe streaming data from Kafka to Ignite for computing and transacting on large-scale data sets in memory.

Image title

Fig 1. Data Continuously Injected via IgniteSinkConnector and Queries by Users.

Connector can be found in 'optional/ignite-kafka.' It and its dependencies have to be on the classpath of a Kafka running instance.
Also, you will need to configure your connector, for instance, as follows

# connector

# cache

where igniteCfg is set to the path to the Ignite cache configuration file, cacheName is the name of the cache you specify in '/some-path/ignite.xml' and the data from someTopic1,someTopic2 will be streamed to. cacheAllowOverwrite is set to true to enable overwriting existing values in the cache.

Another important configuration is Kafka Connect workers' properties, which can look like this for our simple example





Now you can start your connector, for example, in a standalone mode

bin/connect-standalone.sh myconfig/connect-standalone.properties myconfig/ignite-connector.properties

Note that for a distributed mode, myconfig/ignite-connector.properties are not passed on the command line. Use REST API to create, modify and destroy the connector.

Checking the Flow

For a very basic verification of the flow, we can perform the following quick check.

Start Zookeeper and Kafka servers

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties

Since our sample schema handles string data, we can feed key1,val1 via kafka-console-producer (This is done just for illustration -- normally you will use a Kafka producer or source connectors to feed data)

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test --property parse.key=true --property key.separator=,

Then, start the connector as described.

That's all! The data ends up in the Ignite cache, ready for further in-memory processing or analysis via SQL queries (See Apache Ignite docs).

big data, in-memory computing, integration

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}