Tag Archives: RabbitMQ Vs Kafka


RabbitMQ Vs Kafka

Today we have dozens of messaging technologies, countless ESBs, and nearly 100 iPaaS vendors in market. This leads to questions about how to choose the right messaging technology for the user needs – particularly for those who have already invested in a particular choice.

This post explains you, starting with the most modern, popular choices of today: RabbitMQ and Apache Kafka. So, explore this article and know the major differences between these two technologies.


RabbitMQ is a “traditional” message broker that implements a variety of messaging protocols. It was one of the first open source message brokers to attain a reasonable level of features, client libraries, dev tools, and quality documentation. RabbitMQ was originally developed to implement AMQP, an open wire protocol for messaging with powerful routing features. While Java has messaging standards like JMS, so it is not helpful for non-Java applications that need distributed messaging which is severely limiting to any integration scenario, micro service, or monolithic. With the arrival of AMQP, cross-language flexibility became real for open source message brokers


Apache Kafka is developed in Scala and started to connect various internal systems. Kafka is one of those systems that is very simple to describe at a high level, but has an incredible depth of technical detail when you dig deeper. The Kafka documentation does an excellent job of explaining the many design and implementation subtleties in the system. Kafka is well adopted today within the Apache Software Foundation ecosystem of products and is useful in event-driven architecture.

RabbitMQ vs Kafka


import java.util.Properties;

import java.util.Arrays;

import org.apache.kafka.clients.consumer.KafkaConsumer;

import org.apache.kafka.clients.consumer.ConsumerRecords;

import org.apache.kafka.clients.consumer.ConsumerRecord;

public class SimpleConsumer {

public static void main(String[] args) throws Exception {

if(args.length == 0){

System.out.println(“Enter topic name”);



//Kafka consumer configuration settings

String topicName = args[0].toString();

Properties props = new Properties();

props.put(“bootstrap.servers”, “localhost:9092″);

props.put(“group.id”, “test”);

props.put(“enable.auto.commit”, “true”);

props.put(“auto.commit.interval.ms”, “1000”);

props.put(“session.timeout.ms”, “30000”);





KafkaConsumer<String, String> consumer = new KafkaConsumer

<String, String>(props);

//Kafka Consumer subscribes list of topics here.


//print the topic name

System.out.println(“Subscribed to topic ” + topicName);

int i = 0;

while (true) {

ConsumerRecords<String, String> records = con-sumer.poll(100);

for (ConsumerRecord<String, String> record : records)

// print the offset,key and value for the consumer records.

System.out.printf(“offset = %d, key = %s, value = %s\n”,

record.offset(), record.key(), record.value());




Message queues is a broad and interesting topic, in this article we just checked the tip of the iceberg.

Kafka is good for “fast” and reliable consumers.

RabbitMQ is good for “slow” and unreliable consumers.

We recommend you to use as per your analysis and project because, real systems are more complex and the above conclusion is not optimal for every situation.