>From a technical perspective, it's not hard to specify a class to load in Java 
>via a config file and the strategy pattern.  I'm doing it on a project I'm 
>working on for several aspects of the system.  As long as the class adheres to 
>a standardized interface, you could switch out the default Zookeeper client 
>with whatever you wanted.  All you have to do is make sure your class is part 
>of the classpath.  It's one of the few things I truly like about Java.

Casey

________________________________________
From: Bae, Jae Hyeon [metac...@gmail.com]
Sent: Monday, November 19, 2012 1:35 AM
To: kafka-users@incubator.apache.org
Subject: Suggestion on ZkClient usage in Kafka

I want to suggest kafka should create only one instance of ZkClient
globally because ZkClient is thread safe and it will make many users
easily customize kafka source code for Zookeeper.

In our company's cloud environment, it is not recommended to create
ZkClient from zkConnect string directly because zookeeper cluster can
be dynamically changing. So, I have to create ZkClient using our
company's own platform library. Because of this requirement, I can't
use kafka jar file directly. I can modify and build kafka source code
but I have to repeat this work whenever I update kafka version, pretty
annoying.

So, my suggestion is, let me pass ZkClient outs of Producer, Consumer,
and Broker, as the following example.

Producer<String, String> producer =
ProducerBuilder.withZkClient(zkClient).build<String,String>(producerConfig);

ConsumerConnector connector =
Consumer.withZkClient(zkClient).createJavaConsumerConnector(new
ConsumerConfig(consumerProps));

KafkaServer is a little more complicated but I believe without much
effort we can refactor KafkaServer to be customized with ZkClient.

I really appreciate if this suggestion is accepted and merged to 0.8.
If you want me to contribute with this suggestion, please let me know
your opinion. If you are positive with this idea, I will contribute
very happily.

Thank you
Best, Jae

Reply via email to