Skip to Content
Kafka权威指南
book

Kafka权威指南

by Neha Narkhede, Gwen Shapira, Todd Palino
January 2018
Beginner to intermediate
234 pages
7h 8m
Chinese
Posts & Telecom Press
Content preview from Kafka权威指南
3
Kafka
生产者——向
Kafka
写入数据
不管是把
Kafka
作为消息队列、消息总线还是数据存储平台来使用,总是需要有一个可以
Kafka
写入数据的生产者和一个可以从
Kafka
读取数据的消费者,或者一个兼具两种角
色的应用程序。
例如,在一个信用卡事务处理系统里,有一个客户端应用程序,它可能是一个在线商店,
每当有支付行为发生时,它负责把事务发送到
Kafka
上。另一个应用程序根据规则引擎检
查这个事务,决定是批准还是拒绝。批准或拒绝的响应消息被写回
Kafka
,然后发送给发
起事务的在线商店。第三个应用程序从
Kafka
上读取事务和审核状态,把它们保存到数据
库,随后分析师可以对这些结果进行分析,或许还能借此改进规则引擎。
开发者们可以使用
Kafka
内置的客户端
API
开发
Kafka
应用程序。
在这一章,我们将从
Kafka
生产者的设计和组件讲起,学习如何使用
Kafka
生产者。我们
将演示如何创建
KafkaProducer
ProducerRecords
对象、如何将记录发送给
Kafka
,以及
如何处理从
Kafka
返回的错误,然后介绍用于控制生产者行为的重要配置选项,最后深入
探讨如何使用不同的分区方法和序列化器,以及如何自定义序列化器和分区器。
在第
4
章,我们将会介绍
Kafka
的消费者客户端,以及如何从
Kafka
读取消息。
第三方客户端
除了内置的客户端外,
Kafka
还提供了二进制连接协议,也就是说,我们直
接向
Kafka
网络端口发送适当的字节序列,就可以实现从
Kafka
读取消息或
Kafka
写入消息。还有很多用其他语言实现的 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

精通機器學習

精通機器學習

Aurélien Géron
精通特征工程

精通特征工程

Alice Zheng, Amanda Casari
高效能PYTHON程式設計

高效能PYTHON程式設計

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9787115473271