我正在使用以下代码块来发送Kafka消息,
我是否需要在每封邮件发送时初始化CallBack
?相反,我只能使用单实例回调吗?
@Override
public void produce(String txnLogStr) {
ProducerRecord<String, String> record = new ProducerRecord<String, String>(topic, txnLogStr);
producer.send(record, new ProducerCallback());
}
的pom.xml
<!-- KAFKA-QUEUE -->
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<version>0.10.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.10.2.0</version>
</dependency>