To follow up and provide a little more context on my second bullet point, when I run any command for the first time on command line that requires connecting to this code instantiated ZK server I get the specific error:
> bin/kafka-topics.sh --list --zookeeper localhost:2181 java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) But after that it looks like a reconnect is attempted, which succeeds and I'll get a list of my topics or my console consumer will succeed, etc. If I were to run any of those commands a second time, this error then disappears. Anyone have any ideas? On Thu, Jul 9, 2015 at 4:20 PM, Jeff Gong <j.gon...@gmail.com> wrote: > Hey Gwen, > > Thanks for your response. The example was very helpful and exactly what I > was looking for! I went ahead and used that as an example and while most > things are working as I wanted, there are a few issues I'd like to follow > up on: > > 1. If I launch a Zookeeper/Kafka server from code instead of command line, > most of the helpful debugging/status messages will not be displayed -- is > there any way I can retain this functionality? > > 2. I created a scenario where I successfully launched a Zookeeper instance > from code, then connected to that Zookeeper server using a Kafka Server via > command line. I then instantiated both a Kafka-Console-Consumer and > Kafka-Console-Producer with the topic 'test'. I was able to send messages > to the consumer as expected, but I noticed that when I try to connect the > console consumer to the server I always get a 'Connection Refused' error to > my Kafka Broker. Any ideas why this might be occuring? > > Best, > Jeff > > > > On Tue, Jul 7, 2015 at 10:43 AM, Jeff Gong <j.gon...@gmail.com> wrote: > >> Hi all, >> >> Is it possible to launch Kafka/Zookeeper servers via some part of the >> API? I noticed in this: >> http://stackoverflow.com/questions/16946778/how-can-we-create-a-topic-in-kafka-from-the-ide-using-api/ >> that it seems to be possible to create a ZK instance and add a topic to it, >> but is this the same as launching the ZK server as we would in the command >> line? >> >> Similarly, would it be possible to do this for a Kafka server and have it >> connect to an existing ZK connection? >> >> Thanks! >> > >