forked from docs/doc-exports
Reviewed-by: Antonova, Ekaterina <ekantono@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Chen, Junjie <chenjunjie@huawei.com> Co-committed-by: Chen, Junjie <chenjunjie@huawei.com>
5.2 KiB
5.2 KiB
Why Is It Not Recommended to Use a Sarama Client for Messaging?
Symptom
If a Sarama client is used to send and receive messages, the following issues may occur:
- Sarama cannot detect partition changes. Adding topic partitions requires client restart to enable consumption.
- Sarama's default MaxProcessingTime is 100 ms. When this limit is reached, consumers can no longer consume messages.
- If consumer offsets reset from the oldest (earliest) position, all messages starting from the earliest position may be repeatedly consumed after the client restarts.
- A consumer that subscribes to multiple topics may not be able to consume any message from specific partitions.
Solution
Use confluent-kafka-go as the Kafka client library.
For details, see Table 1.
Client |
Pros |
Cons |
---|---|---|
confluent-kafka-go |
|
High compiling complexity because Go compilers need extra resources to configure the imported C++ libraries |
kafka-go |
|
|
Sarama |
Better asynchronization and higher concurrency (written in the original Go language) |
|
Parent topic: Connections