massakam commented on a change in pull request #10279:
URL: https://github.com/apache/pulsar/pull/10279#discussion_r728702722
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java
##########
@@ -169,6 +191,32 @@ private void start() {
@Override
CompletableFuture<MessageId> internalSendWithTxnAsync(Message<?> message,
Transaction txn) {
+ int partition = routerPolicy.choosePartition(message, topicMetadata);
+ checkArgument(partition >= 0 && partition <
topicMetadata.numPartitions(),
+ "Illegal partition index chosen by the message routing policy:
" + partition);
+
+ if (conf.isLazyStartPartitionedProducers() &&
!producers.containsKey(partition)) {
+ final ProducerImpl<T> newProducer = createProducer(partition);
+ final State createState =
newProducer.producerCreatedFuture().handle((prod, createException) -> {
+ if (createException != null) {
+ log.error("[{}] Could not create internal producer.
partitionIndex: {}", topic, partition,
+ createException);
+ try {
+ producers.remove(partition, newProducer);
+ newProducer.close();
+ } catch (PulsarClientException e) {
+ log.error("[{}] Could not close internal producer.
partitionIndex: {}", topic, partition, e);
+ }
+ return State.Failed;
+ }
+ log.debug("[{}] Created internal producer. partitionIndex:
{}", topic, partition);
Review comment:
```suggestion
if (log.isDebugEnabled()) {
log.debug("[{}] Created internal producer.
partitionIndex: {}", topic, partition);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]