consumer.subscribe(Pattern.compile(".*"),new ConsumerRebalanceListener() {
@Override
public void onPartitionsRevoked(Collection<TopicPartition> clctn) {
}
@Override
public void onPartitionsAssigned(Collection<TopicPartition> clctn) {
}
});
如何在apache / kafka中使用正则表达式来使用所有主题? 我尝试了上面的代码,但它没有用。
答案 0 :(得分:2)
对于正则表达式,请使用以下签名
@Query(value = "select "
+ " DFBOGARM, 1 as DFSALVAR, 1 as DSTMND, 1 as DSTMNDAKK, 1 as KVANTUMAKK, "
+ " sum(KVANTUM1) as KVANTUM1, "
+ " (sum(DSTOMK) * 1000 / sum(KVANTUM1)) as DSTOMK, "
+ " (sum(DSTAKK) * 1000 / sum(KVANTUMAKK)) as DSTAKK "
+ "from NHODATA.ERHDSTV1 "
+ "where DFSALVAR in(52, 55) "
+ "group by DFBOGARM "
+ "order by DFBOGARM", nativeQuery = true)
E.g。以下代码段使消费者能够收听前缀为KafkaConsumer.subscribe(Pattern pattern, ConsumerRebalanceListener listener)
my_topics_