标签: apache-kafka-streams
如何将kstream中的数据发送到特定主题分区?
比如说topicA partition2
我尝试了mysteam.to("topic"); 但这没用
mysteam.to("topic");
答案 0 :(得分:2)
您可以使用KStream.to()将自己的分区程序传递到Produced中。
KStream.to()
Produced
请参见https://kafka.apache.org/23/javadoc/org/apache/kafka/streams/kstream/KStream.html#to-java.lang.String-org.apache.kafka.streams.kstream.Produced-
https://kafka.apache.org/23/javadoc/org/apache/kafka/streams/kstream/Produced.html
Partitioner接口的实现示例可在此处找到:
Partitioner
DefaultPartitioner
RoundRobinPartitioner
UniformStickyPartitioner