benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

There is a problem with the logic of creating a producer function in driver-kop

Open wenze159632 opened this issue 1 year ago • 0 comments

The original code and fix are as follows.

  public CompletableFuture<BenchmarkProducer> createProducer(String topic) {
        if (config.producerType.equals(ClientType.KAFKA)) {
            final BenchmarkProducer producer =
                    new KafkaBenchmarkProducer(new KafkaProducer<>(producerProperties), topic);
            producers.add(producer);
            return CompletableFuture.completedFuture(producer);
        } else if (config.consumerType.equals(ClientType.PULSAR)) {
//This condition should be “config.producerType.equals(ClientType.PULSAR) ”
            return producerBuilder
                    .clone()
                    .topic(topic)
                    .createAsync()
                    .thenApply(PulsarBenchmarkProducer::new);
        } else {
            throw new IllegalArgumentException("producerType " + config.producerType + " is invalid");
        }
    }

wenze159632 avatar Mar 01 '24 12:03 wenze159632