I don't have any small examples handy, but the javadoc for KafkaConsumer includes some examples. The one labeled "Simple Processing" should work fine as long as you stick to a single consumer in the group.
On Wed, May 20, 2015 at 7:49 AM, Padgett, Ben <bpadg...@illumina.com> wrote: > @Ewen Cheslack-Postava - do you have an example you could post? > ________________________________________ > From: Ewen Cheslack-Postava [e...@confluent.io] > Sent: Tuesday, May 19, 2015 3:12 PM > To: users@kafka.apache.org > Subject: Re: KafkaConsumer poll always returns null > > The new consumer in trunk is functional when used similarly to the old > SimpleConsumer, but none of the functionality corresponding to the high > level consumer is there yet (broker-based coordination for consumer > groups). There's not a specific timeline for the next release (i.e. "when > it's ready"). > > On Tue, May 19, 2015 at 2:26 PM, Padgett, Ben <bpadg...@illumina.com> > wrote: > > > The links below shows the code is definitely in trunk. > > > > Does anyone know when the source in trunk might be released? > > > > Thanks! > > > > > https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache > > /kafka/clients/consumer/KafkaConsumer.java#L634 > > < > https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L634 > > > > > > > > > https://github.com/apache/kafka/blob/0.8.2/clients/src/main/java/org/apache > > /kafka/clients/consumer/KafkaConsumer.java#L553 > > < > https://github.com/apache/kafka/blob/0.8.2/clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java#L553 > > > > > > > > On 5/19/15, 2:13 PM, "Padgett, Ben" <bpadg...@illumina.com> wrote: > > > > >I came across this google group conversation that suggests KafkaConsumer > > >will not be complete until the next release. > > >( > > > https://groups.google.com/forum/#!msg/kafka-clients/4VLb-_wI22c/imYRlxogo > > >-kJ) > > > > > > > > >``` > > > > > >org.apache.kafka.clients.consumer.KafkaConsumer<String, String> consumer > > >= new org.apache.kafka.clients.consumer.KafkaConsumer<String, > > >String>(consumerProps); > > > > > >consumer.subscribe("project-created"); > > > > > >Map<String, ConsumerRecords<String, String>> records = > consumer.poll(100); > > >assertNotNull(records); > > > > > >``` > > > > > > > > >If I run this from the command line I receive many records: > > > > > >``` > > > > > >bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic > > >project-created --from-beginning > > > > > >``` > > > > > > > > >When using the maven dependency below it appears the older scala > packages > > >are not available. > > > > > >``` > > > > > ><dependency> > > > <groupId>org.apache.kafka</groupId> > > > <artifactId>kafka-clients</artifactId> > > > <version>0.8.2.0</version> > > ></dependency> > > > > > >``` > > > > > >Is there a workaround for this? > > > > > >When is the next release expected to be released? > > > > > >Am I just using the consumer incorrectly? > > > > > >Thanks! > > > > > > > -- > Thanks, > Ewen > -- Thanks, Ewen