【发布时间】:2014-07-14 12:43:01
【问题描述】:
我对卡夫卡很陌生
我已经使用官方示例创建了生产者和消费者组,尽管我想从生产者和消费者发送节俭包以获取包并存储在包数组中。
我已将生产者端代码编写为
KeyedMessage<String, Bundle> data = new KeyedMessage<String, Bundle>("bundles", "Bundle", bundle);
producer.send(data);
但在消费者方面我有
Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
topicCountMap.put(topic, new Integer(NO_OF_THREADS));
Map<String, List<KafkaStream<byte[], byte[]>>> consumerMap = consumer.createMessageStreams(topicCountMap);
List<KafkaStream<byte[], byte[]>> messageStreams = consumerMap.get(topic);
我可以让 kafka 消费者以捆绑类型而不是 byte[] 数组的形式获取数据吗?
【问题讨论】:
标签: thrift producer-consumer apache-kafka