<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pro-Tek Blog &#187; RabbitMQ Vs Kafka</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/tag/rabbitmq-vs-kafka/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>RABBITMQ VS KAFKA</title>
		<link>http://www.pro-tekconsulting.com/blog/rabbitmq-vs-kafka/</link>
		<comments>http://www.pro-tekconsulting.com/blog/rabbitmq-vs-kafka/#comments</comments>
		<pubDate>Wed, 13 Sep 2017 06:12:16 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[KAFKA]]></category>
		<category><![CDATA[RABBITMQ]]></category>
		<category><![CDATA[RabbitMQ Vs Kafka]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2170</guid>
		<description><![CDATA[<p>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 &#8211; particularly for those who have already invested in a particular choice. This post explains you, starting with the most [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/rabbitmq-vs-kafka/">RABBITMQ VS KAFKA</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>RabbitMQ Vs Kafka</h4>
<p>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 &#8211; particularly for those who have already invested in a particular choice.</p>
<p>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.</p>
<p><strong>RABBITMQ</strong></p>
<p>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</p>
<p><strong>APACHE KAFKA</strong></p>
<p>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.</p>
<p><img class="aligncenter wp-image-2171 size-full" src="http://www.pro-tekconsulting.com/blog/wp-content/uploads/2017/09/RabbitMQ-vs-Kafka.png" alt="RabbitMQ vs Kafka" width="512" height="539" /></p>
<p><strong>SIMPLE CONSUMER APPLICATION EXAMPLE USING KAFKA</strong></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">import java.util.Properties;</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">import java.util.Arrays;</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">import org.apache.kafka.clients.consumer.KafkaConsumer;</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">import org.apache.kafka.clients.consumer.ConsumerRecords;</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">import org.apache.kafka.clients.consumer.ConsumerRecord;</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">public class SimpleConsumer {</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">public static void main(String[] args) throws Exception {</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">if(args.length == 0){</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">System.out.println(&#8220;Enter topic name&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">return;</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">}</span></span></span></span></p>
<p><span style="color: #000000;"><span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">//Kafka consumer configuration settings</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">String topicName = args[0].toString();</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">Properties props = new Properties();</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;bootstrap.servers&#8221;, &#8220;localhost:9092&#8243;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;group.id&#8221;, &#8220;test&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;enable.auto.commit&#8221;, &#8220;true&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;auto.commit.interval.ms&#8221;, &#8220;1000&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;session.timeout.ms&#8221;, &#8220;30000&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;key.deserializer&#8221;, </span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">&#8220;org.apache.kafka.common.serializa-tion.StringDeserializer&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">props.put(&#8220;value.deserializer&#8221;, </span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">&#8220;org.apache.kafka.common.serializa-tion.StringDeserializer&#8221;);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">KafkaConsumer&lt;String, String&gt; consumer = new KafkaConsumer</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">&lt;String, String&gt;(props);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">//Kafka Consumer subscribes list of topics here.</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">consumer.subscribe(Arrays.asList(topicName))</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">//print the topic name</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">System.out.println(&#8220;Subscribed to topic &#8221; + topicName);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">int i = 0;</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">while (true) {</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">ConsumerRecords&lt;String, String&gt; records = con-sumer.poll(100);</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">for (ConsumerRecord&lt;String, String&gt; record : records)</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">// print the offset,key and value for the consumer records.</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">System.out.printf(&#8220;offset = %d, key = %s, value = %s\n&#8221;, </span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">record.offset(), record.key(), record.value());</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">}</span></span></span></span></p>
<p><span style="color: #000000;"> <span style="font-family: Calibri, serif;"><span style="font-size: small;"><span lang="en">}</span></span></span></span></p>
<p><strong>CONCLUSION</strong></p>
<p>Message queues is a broad and interesting topic, in this article we just checked the tip of the iceberg.</p>
<p>Kafka is good for “fast” and reliable consumers.</p>
<p>RabbitMQ is good for “slow” and unreliable consumers.</p>
<p>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.</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/rabbitmq-vs-kafka/">RABBITMQ VS KAFKA</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/rabbitmq-vs-kafka/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
