动态拉取topic
//动态感知partition的变化 10ms动态获取topic的元数据,新增的partition会自动从最早的位点开始消费数据
properties.setProperty(FlinkKafkaConsumerBase.KEY_PARTITION_DISCOVERY_INTERVAL_MILLIS, "10");
正则匹配多个topic
FlinkKafkaConsumer<String> consumer = new FlinkKafkaConsumer<>(Pattern.compile("test_topic.*"), deserializationSchema, properties);
参考
【1】flink 消费kafka (exactly-once),动态感知topic,partition, 消费多个topic,区分数据来源 API:https://blog.csdn.net/weixin_40954192/article/details/107561435
网友评论