RobertIndie opened a new pull request #71:
URL: https://github.com/apache/pulsar-dotpulsar/pull/71
This PR adds the basic feature for the partitioned producer.
### Implementation
#### Change of the PulsarClient
Get the partitions count of the topic before creating the producer. The
pulsar client creates a normal producer or partitioned producer by the
partitions count.
Expose an internal method `NewProducer`. This method is used to create
internal producers for the partitioned producer or create a normal producer
without checking partitions count.
#### Change of the ProducerOptions
Add a filed: `MessageRouter`. The default router is the Round Robin
partition router.
#### Add PartitionedProducerProcess
This class is used to maintain the state of the PartitionedProducer. Use two
variables: _partitionsCount and _connectedProducersCount to determine if all
sub-producers are successfully connected.
When ProducerProcess state change occurs, ProducerProcess will send the
PartitionedSubProducerStateChanged(IEvent) to the PartitionedProducerProcess.
Here it updates its own state based on the state changes of sub-producers.
#### Add PartitionedProducer
When initializing the partitioned producer, create all sub-producers. The
partitioned producer will route messages to sub-producers using the message
router.
This PR does not add the support for updating the partitions count of the
topic. I will add this support in the next PR.
## Here are a few more things we need to discuss
* In order to let partitioned producers use the
ProducerOptions→StateChangeHandler, I changed the original solution that we
discussed of separating ProducerState and PartitionedProducerState. The new
solution is to add the PartiallyConnected state to the ProducerState. Is this a
good solution?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]