Properties producerProps = new Properties();
producerProps.put(ProducerConfig.INTERCEPTOR_CLASSES_CONFIG, "fully qualified name of your interceptor class");
//... add other properties
KafkaProducer<String,String> kProd = new KafkaProducer<>(producerProps);
1条答案
按热度按时间4ioopgfo1#
创建kafkaproducer对象时,将其传递到属性中,例如。