public static void main(String[] args)
{
generateData();
SimpleConsumer simpleConsumer = new SimpleConsumer(KafkaProperties.kafkaServerURL,
KafkaProperties.kafkaServerPort,
KafkaProperties.connectionTimeOut,
KafkaProperties.kafkaProducerBufferSize);
System.out.println("Testing single fetch");
FetchRequest req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
ByteBufferMessageSet messageSet = simpleConsumer.fetch(req);
printMessages(messageSet);
System.out.println("Testing single multi-fetch");
req = new FetchRequest(KafkaProperties.topic2, 0, 0L, 100);
List<FetchRequest> list = new ArrayList<FetchRequest>();
list.add(req);
req = new FetchRequest(KafkaProperties.topic3, 0, 0L, 100);
list.add(req);
MultiFetchResponse response = simpleConsumer.multifetch(list);
int fetchReq = 0;
while(response.hasNext())
{
System.out.println("Response from fetch request no: " + ++fetchReq);
messageSet = response.next();