apache-kafka - (功能性)Spring Cloud Stream 自定义分区键实现,用于将消息列表发布到单个 Kafka 主题
问题描述
我创建了一个应用程序,它使用基于函数的 Spring 云流库将消息列表发布到单个 Kafka 主题。我想知道我们如何为列表中的每条消息设置分区键。基本上,每条消息都应该有自己的分区键逻辑。目前,如果我编写 custom ,它不会发布partitionKeyExtractor
。让我知道是否有人以前解决过这个问题。例如:
Function<Message<String, List<Message<String>> processor(NotificationProcessor notification) {
return notification::processNotification
}
解决方案
推荐阅读
- angular - 使用 BrightCove Player Loader 的角度问题
- reactjs - 有没有办法为 expo-av 视频制作自定义控件组件?
- google-apps-script - 你能解释一下为什么我会收到这个错误:Unexpected error while getting the method or property getContacts on object ContactsApp
- java - 我可以在 jboss EAP 7.3 容器中直接包含相关的 jar 文件吗?
- bash - 如何通过中间计算机进行 scp
- javascript - 文本输入未触发更改事件
- python - Pandas:如何使用计数器删除与特定条件不匹配的行?
- grep - 试图弄清楚为什么我的正则表达式命令不起作用
- php - Laravel - 自定义缓存属性(getter?)
- apache - 如何根据.htacess中的特定条件执行一批重定向规则