paladin-dalao commented on issue #50:
URL:
https://github.com/apache/pulsar-client-cpp/issues/50#issuecomment-1288964863
Hello @BewareMyPower
When the producer is created, the number of partions is specified, so the
server adjusts the producer of the partion client and cannot be synchronized to
the latest one?
```
void ClientImpl::handleCreateProducer(const Result result, const
LookupDataResultPtr partitionMetadata,
TopicNamePtr topicName,
ProducerConfiguration conf,
CreateProducerCallback callback) {
if (!result) {
ProducerImplBasePtr producer;
if (partitionMetadata->getPartitions() > 0) {
producer =
std::make_shared<PartitionedProducerImpl>(shared_from_this(), topicName,
`partitionMetadata->getPartitions()`, conf);
} else {
producer = std::make_shared<ProducerImpl>(shared_from_this(),
*topicName, conf);
}
producer->getProducerCreatedFuture().addListener(
std::bind(&ClientImpl::handleProducerCreated,
shared_from_this(), std::placeholders::_1,
std::placeholders::_2, callback, producer));
Lock lock(mutex_);
producers_.push_back(producer);
lock.unlock();
producer->start();
} else {
LOG_ERROR("Error Checking/Getting Partition Metadata while creating
producer on "
<< topicName->toString() << " -- " << result);
callback(result, Producer());
}
}
```
--
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]