You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/11/12 20:53:10 UTC
[GitHub] merlimat commented on issue #2972: Introduce
`Client.getPartitionsForTopic()`
merlimat commented on issue #2972: Introduce `Client.getPartitionsForTopic()`
URL: https://github.com/apache/pulsar/pull/2972#issuecomment-438024684
> @merlimat what's the motivation for this? This is the first thing to introduce partitions in the client API.
Motivation is to create consumers (and more typically readers) on the specific partitions.
There are multiple reasons for this to be useful:
* Reader can only be created on 1 partition. When reading from a partitioned topic, application will have to know upfront the number of partitions
* There is a REST API for that, though inconvenient from client lib
* The other often suggested route was to downcast `PulsarClient` to `PulsarClientImpl` and call https://github.com/apache/pulsar/blob/c2977bef98a2189f0aef70a97c76240bfa24a191/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java#L791 though we should have an "official" way to do this
In general, if you want to use some custom logic to assign consumers/readers to partitions, you need to known the number of partitions and their names (the name is with `-partition-N`, though I believe it's better to provide the list rather than just then number).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services