- Building Data Streaming Applications with Apache Kafka
- Manish Kumar Chanchal Singh
- 304字
- 2022-07-12 10:38:13
Message producers
In Kafka, the producer is responsible for sending data to the partition of the topic for which it is producing data.
The hash value is generally calculated by the message key that we provide when writing the message to a Kafka topic. The message with a null key will be distributed in a round-robin fashion across partitions to ensure even distribution of messages. In Kafka, each partition has a leader and each read write request goes through the leader only. So a request to write messages to a partition of a topic will go through the leader broker. The producer waits for an acknowledgement of messages depending on the setting. Generally, it waits until the replication for a particular message is successfully acknowledged.
However, you can set the configuration for acknowledgement to 1, which assumes that if a message is committed by the leader, it will be available to read and the Kafka producer can produce the next messages. This setting is dangerous because, if brokers fail before other replicas commit the message, the message will be lost. This leads to less durability but high throughput.
However, it's better to compromise on throughput if your consumer system does not want to lose a single message as part of the application. We will talk in detail about the producer in the next chapter.
- Learning Scala Programming
- Learning ROS for Robotics Programming(Second Edition)
- 自然語言處理實戰:預訓練模型應用及其產品化
- Dependency Injection in .NET Core 2.0
- Django:Web Development with Python
- Mastering Julia
- Learning ArcGIS Pro
- Python自然語言處理(微課版)
- TradeStation交易應用實踐:量化方法構建贏家策略(原書第2版)
- 深入淺出PostgreSQL
- Unity 2D Game Development Cookbook
- 從零開始學Linux編程
- 現代C++編程實戰:132個核心技巧示例(原書第2版)
- Illustrator CC平面設計實戰從入門到精通(視頻自學全彩版)
- Django 5企業級Web應用開發實戰(視頻教學版)