1
소비자/고객을위한 카프카 서버 폴링 (KAFKA 0.10.0.0)이 있습니까?카프카 서버 폴링 대체
KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
consumer.subscribe(Arrays.asList("foo", "bar"));
while (true) {
ConsumerRecords<String, String> records = consumer.poll(100);
for (ConsumerRecord<String, String> record : records)
System.out.printf("offset = %d, key = %s, value = %s", record.offset(), record.key(), record.value());
}
왜이 질문을합니까? 폴링이 문제를 일으키고 있습니까? –
사실 내 요구 사항은 소비자를위한 휴식 API를 구현하는 것입니다. 지속적으로 폴링 중이라면 소비자로부터 메시지를 얻을 수 없습니다. – gsc0441
Confluent의 REST 프록시를 사용하지 않는 이유는 무엇입니까? https://github.com/confluentinc/kafka-rest 및 http://docs.confluent.io/3.0.0/kafka-rest/docs/ 및 http://www.confluent.io/blog/a-comprehensive -open-source-rest-proxy-for-kafka/ –