Kafka Streams in Action

William P. Beijack Jr.Posts & Telecom Press2019

Rating 3.4
Word count
216K words
Chapters
15
ISBN
9787115507396

Tags

Computing Programming Java TechnologyBig DataReal-Time ComputingDevelopersData ProcessingField CasesBeginner Knowledge

Summary

Kafka Streams is a Java library provided by Apache Kafka for building stream-processing applications. Unlike stream-processing frameworks such as Storm and Spark Streaming, it depends only on Kafka itself and requires no additional stream-processing cluster, so it can be seen as a lightweight, easy-to-use stream-processing API. This book is the Chinese translation of Kafka Streams in Action from Manning, aimed at Java developers who want to build real-time data processing applications with Kafka Streams. The book has 9 chapters in 4 parts. Part 1 builds the conceptual foundation, covering the limitations of big data and batch processing, the idea of stream processing, and how to break down a purchase transaction into a node graph, and introduces Kafka basics such as architecture, partitions, producers and consumers, and installation and operation; Part 2 is the development core, starting from a Hello World example and using a fictional retailer's customer data and purchase transactions to explain KStream state operations, state stores, various joins (stream-table, table-stream, stream-stream), timestamps and event time, KTable update semantics, aggregation and windowing, and the low-level processor API with a stock analysis example; Part 3 covers management and operations, including monitoring and debugging tools such as consumer lag, JMX metrics, state listeners, and exception handling, as well as topology testing, processor unit testing, and integration testing with embedded Kafka; Part 4 moves to advanced topics, introducing Kafka Connect for ingesting external data sources, interactive queries as a replacement for relational databases behind dashboards, and KSQL's stream-table concepts and query syntax. Two appendices cover configuration tuning and exactly-once processing semantics.

Editor's review

市面上讲 Kafka 的书不少,但真正把「流式处理应用怎么写、怎么测、怎么上线」讲清楚的并不算多,这本《Kafka Streams实战》正好补上了这块空缺。作者 Bejeck 是 Kafka 社区的长期贡献者,书中不只罗列 API,还强调了一些比较通用的概念,比如聚合、时间窗口、事件时间与处理时间的区别、多种连接方式、流与表的关系等;即便日后换用别的流式框架,这些知识依然用得上。全书 235 页,结构清晰:先用一张交易处理节点图帮你建立「心智模型」,再顺着真实的零售场景一步步加特性,而不是止步于 Hello World。更难能可贵的是,它花了整整两章讲监控和测试,而这恰恰是很多入门书跳过的部分。不过也要说明,本书写作时间较早,示例基于当时的 Kafka Streams DSL,KSQL 的语法名称后来已改为 ksqlDB,跟着敲代码时需要对版本差异做些适配。

Who it's for

A good fit for

Not a good fit for

Reading tips

  1. 第 2 章是 Kafka 基础速览,熟悉 Kafka 的读者可快速翻阅,把精力放在第 3 章之后的示例上。
  2. 务必一边阅读一边动手敲代码,先跑通 Hello World,再按书中零售商场景逐步添加功能。
  3. 读到第 4、5 章时画一张 KStream 与 KTable 的数据流草图,有助于理解表流二元性和连接语义。
  4. 阅读时对照当前版本的 Kafka 官方文档,注意 KSQL 已演进为 ksqlDB,API 细节以官方为准。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Part 1: Getting Started with Kafka Streams
  2. Chapter 1: Welcome to Kafka Streams
  3. Chapter 2: A Quick Guide to Kafka
  4. Part 2: Developing with Kafka Streams
  5. Chapter 3: Developing Kafka Streams
  6. Chapter 4: Streams and State
  7. Chapter 5: The KTable API
  8. Chapter 6: The Processor API
  9. Part 3: Managing Kafka Streams
  10. Chapter 7: Monitoring and Performance
  11. Chapter 8: Testing Kafka Streams Applications
  12. Part 4: Advanced Kafka Streams
  13. Chapter 9: Advanced Applications of Kafka Streams
  14. Appendix A: Additional Configuration Information
  15. Appendix B: Exactly-Once Processing Semantics

FAQ

这本书适合零基础学 Kafka 吗? 不完全适合。书中第 2 章只是对 Kafka 核心概念做了快速梳理,重点在于 Kafka Streams 的使用,且示例都基于 Java。零基础读者最好先补一补 Java 和 Kafka 的基本用法,再读本书会顺畅得多。
书名里的 Streams 是 Kafka 自带的组件吗? 是的。Kafka Streams 是 Apache Kafka 官方提供的一个构建流式处理的 Java 库,它依赖 Kafka 作为数据源与状态存储,不需要像 Storm、Spark 那样另起一套计算集群,因此部署和运维相对轻量。
书中讲的 KSQL 现在还能用吗? KSQL 后来已演进为 Confluent 的 ksqlDB,名称和部分语法有调整。本书第 9 章介绍的流表概念、交互式查询思路仍然适用,但具体命令建议按当前 ksqlDB 官方文档执行。
读完能学到什么程度的实战能力? 能独立写出基于 DSL 和处理器 API 的流式拓扑,实现有状态操作、连接与窗口聚合,并对应用做监控、单元测试和集成测试,还能用 Kafka Connect 和交互式查询把流应用接入现有系统。

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

William P. Beijack Jr. Author

William P. Beijack Jr. is an author about whom little public information is available. His one known work is Kafka Streams in Action, a book in the computer and programming design category that focuses on the Kafka Streams stream-processing technology and is aimed at developers who want to build streaming data applications in real projects. This single work suggests that his writing emphasizes technical practice, combining the use of the framework and its core concepts with engineering scenarios rather than staying at an abstract theoretical level. For readers learning stream processing, such a book can serve as an introduction and a hands-on reference. Because no reliable records of his birth and death dates, nationality, education, or professional career are available, his personal biography cannot be described further; knowledge of him and his work currently rests mainly on this one title.