is there alternate kafka server polling consumer/client (in 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); (consumerrecord<string, string> record : records) system.out.printf("offset = %d, key = %s, value = %s", record.offset(), record.key(), record.value()); }
no. brokers in kafka passive , clients need pull data there (a push model not supported).
the poll loop example recommended. see http://docs.confluent.io/3.0.0/clients/consumer.html#java-client
Comments
Post a Comment