title: Not able to see kafka messages produced from Java api in the consumer console
body: <p>I was trying to produce some messages and put into topic, and then getch the same from console consumer.</p>
  
  <p>Code used :</p>
  
  <pre><code>import  java.util.Date;
  import  java.util.Properties;
  import  kafka.javaapi.producer.Producer;
  import  kafka.producer.KeyedMessage;
  import  kafka.producer.ProducerConfig;
  
  
  public  class   SimpleProducer  {
      private static  Producer&lt;String,String&gt; producer;
      public  SimpleProducer()    {
              Properties  props   =   new Properties();
  
              //  Set the broker  list    for requesting  metadata    to  find    the lead    broker
              props.put("metadata.broker.list","172.22.96.56:9092,172.22.96.56:9093,172.22.96.56:9094");
  
              //This  specifies   the serializer  class   for keys    
              props.put("serializer.class",   "kafka.serializer.StringEncoder");
  
              //  1   means   the producer    receives    an  acknowledgment  once    the lead replica    
              //  has received    the data.   This    option  provides    better  durability  as  the     
              //  client  waits   until   the server  acknowledges    the request as successful.
              props.put("request.required.acks",  "1");
  
              ProducerConfig  config  =   new ProducerConfig(props);
              producer    =   new Producer&lt;String,    String&gt;(config);
      }
      public  static  void    main(String[]   args)   {
              int argsCount   =   args.length;
              if  (argsCount  ==  0   ||  argsCount   ==  1)
                      throw   new IllegalArgumentException(
                              "Please provide topic   name    and Message count   as  arguments");
  
              String  topic   =   (String)    args[0];
              String  count   =   (String)    args[1];
              int messageCount    =   Integer.parseInt(count);
              System.out.println("Topic   Name    -   "   +   topic);
              System.out.println("Message Count   -   "   +   messageCount);
              SimpleProducer  simpleProducer  =   new SimpleProducer();
              simpleProducer.publishMessage(topic,    messageCount);
      }
      private void    publishMessage(String   topic,  int messageCount)   {
              for (int    mCount  =   0;  mCount  &lt;   messageCount;   mCount++)   {
                      String  runtime =   new Date().toString();
                      String  msg =   "Message    Publishing  Time    -   "   +   runtime;
                      System.out.println(msg);
                      //  Creates a   KeyedMessage    instance
                      KeyedMessage&lt;String,    String&gt; data    =   
                              new KeyedMessage&lt;String,    String&gt;(topic,  msg);
  
                      //  Publish the message
                      producer.send(data);
              }
              //  Close   producer    connection  with    broker.
              producer.close();
      }
  </code></pre>
  
  <p>}</p>
  
  <p>OUTPUT:</p>
  
  <blockquote>
    <p>Topic  Name    -   test
    Message Count   -   10
    log4j:WARN No appenders could be found for logger 
    (kafka.utils.VerifiableProperties).
    log4j:WARN Please initialize the log4j system properly.
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016
    Message Publishing  Time    -   Tue Feb 16 02:00:56 IST 2016</p>
  </blockquote>
  
  <p>from command line i supply the name of the topic as "kafkatopic" and count of the messages "10". The program runs fine without ant exception but when i try to see the messages from console, they do not appear. The topic is created.</p>
  
  <blockquote>
    <p>bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic kafkatopic --from-beginning </p>
  </blockquote>
  
  <p>Can you plaease help as what went wrong!!</p>