<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hugo Wood on Medium]]></title>
        <description><![CDATA[Stories by Hugo Wood on Medium]]></description>
        <link>https://medium.com/@mercury_wood?source=rss-fef4e25ffef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*X3POOuFmuzOQ2WFsiEJTdw.jpeg</url>
            <title>Stories by Hugo Wood on Medium</title>
            <link>https://medium.com/@mercury_wood?source=rss-fef4e25ffef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:18:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mercury_wood/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What is Apache Kafka?]]></title>
            <link>https://medium.com/zenika/what-is-apache-kafka-e2f0ff6d2143?source=rss-fef4e25ffef------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2f0ff6d2143</guid>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Hugo Wood]]></dc:creator>
            <pubDate>Mon, 28 Jan 2019 12:31:27 GMT</pubDate>
            <atom:updated>2019-01-28T13:08:22.649Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This is a translation from a 2017 article, originally posted in French <a href="https://blog.zenika.com/2017/09/14/mais-cest-quoi-apache-kafka/">here</a>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*kdp_y7VTwZ-499q6.png" /></figure><p><a href="https://kafka.apache.org/">Apache Kafka</a> came out of the Apache incubator in 2012. Over the last few years, its ecosystem has grown and with it all the use cases for which Kafka is appropriate.</p><p>We now have a mature technology, ready to be used not only on big data projects, but on any project where the data is crucial, that is, in my opinion, 100% of business applications.</p><p>In the wake of <a href="https://www.confluent.io/blog/ksql-open-source-streaming-sql-for-apache-kafka/">the announcement of KSQL</a> (SQL for Kafka) which provides an interactive SQL interface for data processing in Kafka and also after the release of<a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=71764913"> Kafka 1.0</a>, now is the time to re-examine what this technology can bring us.</p><h3><strong>A message bus</strong></h3><p>Many assumed that Kafka was a competitor of <a href="https://www.rabbitmq.com/">RabbitMQ</a>, and that it was a message broker. This was the intention of its designers when it was created at LinkedIn: a very resilient (distributed with replication) and high-performance broker (millions of messages per second). However, these constraints have made Kafka unique among brokers. Kafka is simpler and more versatile.By the way, it is programmed in Scala and Java.</p><h3><strong>A low-level database</strong></h3><p>At its heart, Kafka is a storage system for messages <em>(streams of records)</em>. Each message is composed of a value, a key (we will elaborate on its use later), and a timestamp.</p><p>Kafka organizes messages into categories called <em>topics</em>. Topics are specifically ordered and and are named sequences of messages. They are not editable except for adding messages at the end.</p><p>A Kafka client cannot: edit or delete a message; change the order of messages; insert a message into a topic anywhere other than at the end; create or delete a topic. A producer adds messages at the end of the topics of its choice, that’s all.</p><p>The consumer reads topics from a given index or timestamp, always in the same order — from the oldest message to the most recent, and without stopping.</p><p>If a consumer has processed all the messages in a topic, it stays connected to receive the new messages inserted by the producers. Although the term “consumption” is used, the message is simply read, not deleted. Because topics are immutable, they can be read simultaneously by multiple consumers. Each of them is at a different index and is reading at a different speed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y-ov2ezEYihqKzZC.png" /></figure><p>Any database management system has a log of change requests that are addressed to it (<a href="https://www.confluent.io/blog/turning-the-database-inside-out-with-apache-samza/">for replication, building indexes, or materialized views</a>). Kafka makes this type of log its central concept, while other DBMS’ add layers of abstraction over it (tables, documents, graphs, …). It is the absence of these layers that makes Kafka simple, flexible and efficient. <a href="https://www.confluent.io/blog/leveraging-power-database-unbundled/">Kafka is a low-level database</a>.</p><h3><strong>A stream processing framework</strong></h3><p>The low-level aspect has an advantage. It gives freedom to application developers to create their own abstractions. But it also has a disadvantage. It forces application developers to create their own abstractions. In addition, creating distributed and resilient abstractions is difficult. This is where recent additions to Kafka come into play: Kafka Streams and Kafka Connect.</p><h4><strong>Kafka Streams</strong></h4><p><a href="https://kafka.apache.org/documentation/streams/">Kafka Streams</a> is a Java library that enables APIs to develop <em>streaming </em>message processing units. It deals with the management of consumption and emission of messages, concurrency management, etc. leaving the developer with (almost) only the job of writing the transformation code. It’s also very easy to deploy: just run an ordinary JAR. Run it multiple times to scale horizontally. The code can alternatively be embedded into an existing Java application.</p><p>When reading a Kafka topic with Streams, There’s a choice between two abstractions: <em>stream</em> and table. In a stream, each message is considered independent (<em>it’s called stateless processing</em>). In a table, each message is considered a new version of the previous message of the same key (<em>stateful processing</em>). This is how we find our familiar CRUD. The first message for a given key forms the Create, the following messages with the same key form Updates, and a message with the same key but with a null value forms the Delete. This is similar to INSERT, UPDATE, DELETE in SQL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*bX3dxVIcA1Dn0f4m.png" /><figcaption>The duality stream / table: move from one to another.</figcaption></figure><p>The table is an associative array (or map, dict, hash according to your preferred language) updated with each message. This associative table is managed by Kafka Streams. It is searchable (read / retrieve from CRUD) quickly because it is stored in memory, and replicated on Kafka for resiliency. But let’s go further. If instead of overwriting the old value of the associative array with the new value of the last message, a function is used to calculates a result from these two values, then we can aggregate messages arbitrarily: count, sum, minimum, maximum, average, accumulation … This is similar to GROUP BY, SUM, MIN, MAX, and other aggregate functions in SQL.</p><p>Finally, we can <a href="https://kafka.apache.org/0110/documentation/streams/developer-guide#streams_dsl_joins">join</a> two tables, a table and a stream, or two streams, again similar to SQL.</p><p>The parallels with SQL are not random. SQL is the best-known data transformation language, and data transformation technologies end up supporting it sooner or later (see <a href="https://spark.apache.org/">Spark</a> , <a href="https://flink.apache.org/">Flink</a> , <a href="http://storm.apache.org/">Storm</a> ). The developer preview of KSQL, SQL for Kafka, was announced on August 28, 2017. In the near future, Kafka Streams should therefore be replaced by KSQL, which promises to reduce development costs.</p><h4><strong>Kafka Connect</strong></h4><p>Kafka Streams is a very powerful tool, but sometimes it is not enough. For example, our business application may need advanced search features. In this type of case we can rely on specialized technologies. For our understanding, Elasticsearch or Solr would do the trick. <a href="https://kafka.apache.org/documentation.html#connect">Kafka Connect</a> makes it easy to set up this type of architecture. By providing only the configuration, Kafka Connect links upstream data sources, and target databases downstream to Kafka. This is very useful at a time when we know that a single database technology cannot meet all needs.</p><h3><strong>Use cases</strong></h3><h4><strong>Classic cases</strong></h4><ol><li>Kafka is relevant as a message bus, especially if you have special needs in terms of performance.</li><li>Kafka is an excellent choice for ETL (extract-transform-load): Connect provides the E and the L, Streams the T, and Kafka itself offers a storage buffer that ensures scalability, resilience and reliability. It ensures repeatability of the process. In addition, ETL becomes real time!</li><li>Kafka is perfectly suited for real-time analysis (since it is finally a special case of ETL, with a large T and an absent or small L).</li></ol><h4><strong>Less classic: the source of truth</strong></h4><p>As an <a href="https://kafka.apache.org/intro">introduction to Kafka’s documentation</a>, we have a technology that stores data in a distributed and resilient manner, is able to transform this data and also is able to distribute this data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pHEdk2y4pFXA4_4I.png" /></figure><p>What better place to store the essential data of an application?</p><p>Let’s take a step back. In business applications, an application receives external signals. Those might be user commands via a graphical interface, or from other applications. An application also makes decisions according to business logic, and then changes its current state to reflect the consequences of the decisions taken. This system basically loses some data, since the orders received have nowhere been recorded, nor has the previous state been recorded! Instead of backing up the essential data, you end up saving the derived data.</p><p>What if we did the opposite? Some of you may recognize the principles of <a href="https://martinfowler.com/eaaDev/EventSourcing.html">event sourcing</a> here. If all commands / events received by the application are saved in Kafka, then we have a complete history that can be replayed at will to reconstruct the current state, an old state, new states etc. <a href="https://www.confluent.io/blog/messaging-single-source-truth/">Kafka then becomes the source of truth of the application</a>.</p><p>Business logic can now rely on the full history of the application and derive new data. Thanks to Kafka Streams, the business logic works in real time, is resilient and scalable. Output decisions are again kept in Kafka. Kafka Streams also prepares data and formats it so that it can be easily consumed downstream (graphical interfaces or external systems). This replaces the indexes, views, and materialized views of a classic database. Finally, Streams provide the data, either directly via web services, or by depositing them into a Kafka topic that Connect dumps into a third-party DBMS, <a href="https://martinfowler.com/bliki/CQRS.html">which serves as a downstream data view</a> .</p><h4><strong>The future of data management?</strong></h4><p>It seems to me that the architecture that I have just presented provides elements that bring us closer to the utopia proposed in <a href="https://github.com/papers-we-love/papers-we-love/blob/master/design/out-of-the-tar-pit.pdf"><em>Out of the Tar Pit</em></a>.</p><p>Could such an architecture be put in place at the enterprise level?</p><p>The New York Times has just published a <a href="https://www.confluent.io/blog/publishing-apache-kafka-new-york-times/">post</a> on their use of Kafka to store the complete history of their publications. I think Apache Kafka has the potential to become the cornerstone of data management and integration in organizations.</p><p>If you are interested in the subject, you should know that Zenika provides official Kafka training for <a href="https://training.zenika.com/formations/confluent-developer">developers</a> and <a href="https://training.zenika.com/formations/confluent-operations-kafka">ops</a> .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2f0ff6d2143" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zenika/what-is-apache-kafka-e2f0ff6d2143">What is Apache Kafka?</a> was originally published in <a href="https://medium.com/zenika">Zenika</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>