use of com.ibm.streamsx.kafka.clients.producer.AtLeastOnceKafkaProducerClient in project streamsx.kafka by IBMStreams.
the class AbstractKafkaProducerOperator method initProducer.
private void initProducer() throws Exception {
// configure producer
KafkaOperatorProperties props = getKafkaProperties();
if (crContext == null) {
logger.info("Creating KafkaProducerClient...");
producer = new KafkaProducerClient(getOperatorContext(), keyType, messageType, props);
} else {
switch(consistentRegionPolicy) {
case AtLeastOnce:
logger.info("Creating AtLeastOnceKafkaProducerClient...");
producer = new AtLeastOnceKafkaProducerClient(getOperatorContext(), keyType, messageType, props);
break;
case Transactional:
logger.info("Creating TransactionalKafkaProducerClient...");
producer = new TransactionalKafkaProducerClient(getOperatorContext(), keyType, messageType, props, /*lazyTransactionBegin*/
true);
break;
default:
throw new RuntimeException("Unrecognized ConsistentRegionPolicy: " + consistentRegionPolicy);
}
}
}
Aggregations