()
| 53 | } |
| 54 | |
| 55 | public void run() { |
| 56 | Map<String, Integer> topicCountMap = new HashMap<String, Integer>(); |
| 57 | topicCountMap.put(topic, new Integer(1)); |
| 58 | Map<String, List<KafkaStream<byte[], byte[]>>> consumerMap = consumer.createMessageStreams(topicCountMap); |
| 59 | KafkaStream<byte[], byte[]> stream = consumerMap.get(topic).get(0); |
| 60 | ConsumerIterator<byte[], byte[]> it = stream.iterator(); |
| 61 | while(it.hasNext()) |
| 62 | System.out.println(new String(it.next().message())); |
| 63 | } |
| 64 | } |