Apache Kafka - KafkaStream on topic/partition

前端 未结 3 1913
夕颜
夕颜 2021-02-06 04:23

I am writing Kafka Consumer for high volume high velocity distributed application. I have only one topic but rate incoming messages is very high. Having multiple partition that

3条回答
  •  不思量自难忘°
    2021-02-06 05:06

    /**
     * @param source : source kStream to sink output-topic
     */
    private static void pipe(KStream source) {
        source.to(Serdes.String(), Serdes.String(), new StreamPartitioner() {
    
            @Override
            public Integer partition(String arg0, String arg1, int arg2) {
                return 0;
            }
        }, "output-topic");
    }
    

    above code will write record at partition 1 of topic name "output-topic"

提交回复
热议问题