跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[Kafka] Kafka 消息处理冲突问题

发表于

背景

我目前有一个 Kafka 集群,包含两个 Kafka 服务器,它们共享同一个 Zookeeper 。集群中有两个主题:corpnet-requests 和 corpnet-responses ,这两个主题都有 3 个 partition 。

系统中有四个客户端:

Client AClient B:订阅两个 Kafka 服务器上的 corpnet-requests 和 corpnet-responses 主题。这两个客户端负责生产包含 guid 、url 、payload 和 auth 的消息到 corpnet-requests 主题。

Client CClient D:同样订阅两个 Kafka 服务器上的 corpnet-requests 和 corpnet-responses 主题。这两个客户端负责消费 corpnet-requests 主题中的消息,执行实际的 HTTP 请求,并将响应结果生产到 corpnet-responses 主题中。

Client AClient B:除了生产请求消息外,还需要消费 corpnet-responses 主题中的消息,以获取实际的 HTTP 响应,完成一次请求的逻辑。

以上设计主要用于解决 Client A 和 B 无法访问公司内网资源的问题,公司内网无法通过 vpn 访问。

问题描述

由于 corpnet-requests 和 corpnet-responses 主题都有多个分区,我担心会出现以下冲突情况:

Client A生产的请求消息的响应(由Client CClient D生成)可能会被Client B消费,反之亦然。

我的疑问

请教各位大佬如何确保每个请求的响应能够准确地返回给发起请求的客户端(即Client A的请求响应不会被Client B消费,反之亦然)。似乎通过 key 来限制 partition 或者规划消费者组都无法保证,当然也有可能是我学艺不精理解有误。。

欢迎大家提供解决方案或建议,谢谢!

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.