[
https://issues.apache.org/jira/browse/KAFKA-5387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Bart Vercammen updated KAFKA-5387:
----------------------------------
Description:
Kafka producer has a method to expose the number of partitions for a specific
topic.
{noformat} public List<PartitionInfo> partitionsFor(String topic) {
try {
return waitOnMetadata(topic, null,
maxBlockTimeMs).cluster.partitionsForTopic(topic);
} catch (InterruptedException e) {
throw new InterruptException(e);
}
}
{noformat}
Instead of only returning the number of available partitions for a topic, it
would be nice that the entire cluster metadata is exposed to the caller.
This way we can make use of the partitioners in a more dynamic way.
Something like this maybe :
{noformat}public Cluster clusterMetaData() {noformat}
or, when updated metadata is required for a list of topics the producer did not
already sent data to: {noformat}public Cluster clusterMetaData(List<String>
topics) {noformat}
Or, maybe even better, have the possibility to provide a partitioner when
producing data on kafka, instead of only a specific partition number or a
globally configured partitioner-class.
{noformat}
public Future<RecordMetadata> send(ProducerRecord<K, V> record, Partitioner
partitioner, Callback callback)
{noformat}
Any suggestions or comments?
was:
Kafka producer has a method to expose the number of partitions for a specific
topic.
{noformat} public List<PartitionInfo> partitionsFor(String topic) {
try {
return waitOnMetadata(topic, null,
maxBlockTimeMs).cluster.partitionsForTopic(topic);
} catch (InterruptedException e) {
throw new InterruptException(e);
}
}
{noformat}
Instead of only returning the number of available partitions for a topic, it
would be nice that the entire cluster metadata is exposed to the caller.
This way we can make use of the partitioners in a more dynamic way.
Something like this maybe :
{noformat}public Cluster clusterMetaData() {noformat}
Or, maybe even better, have the possibility to provide a partitioner when
producing data on kafka, instead of only a specific partition number or a
globally configured partitioner-class.
{noformat}
public Future<RecordMetadata> send(ProducerRecord<K, V> record, Partitioner
partitioner, Callback callback)
{noformat}
Any suggestions or comments?
> [Kafka Producer] - expose cluster metadata
> ------------------------------------------
>
> Key: KAFKA-5387
> URL: https://issues.apache.org/jira/browse/KAFKA-5387
> Project: Kafka
> Issue Type: Improvement
> Components: producer
> Affects Versions: 0.10.2.1
> Reporter: Bart Vercammen
>
> Kafka producer has a method to expose the number of partitions for a specific
> topic.
> {noformat} public List<PartitionInfo> partitionsFor(String topic) {
> try {
> return waitOnMetadata(topic, null,
> maxBlockTimeMs).cluster.partitionsForTopic(topic);
> } catch (InterruptedException e) {
> throw new InterruptException(e);
> }
> }
> {noformat}
> Instead of only returning the number of available partitions for a topic, it
> would be nice that the entire cluster metadata is exposed to the caller.
> This way we can make use of the partitioners in a more dynamic way.
> Something like this maybe :
> {noformat}public Cluster clusterMetaData() {noformat}
> or, when updated metadata is required for a list of topics the producer did
> not already sent data to: {noformat}public Cluster
> clusterMetaData(List<String> topics) {noformat}
> Or, maybe even better, have the possibility to provide a partitioner when
> producing data on kafka, instead of only a specific partition number or a
> globally configured partitioner-class.
> {noformat}
> public Future<RecordMetadata> send(ProducerRecord<K, V> record, Partitioner
> partitioner, Callback callback)
> {noformat}
> Any suggestions or comments?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)