Hi Li Li,
If you use the same consumer group id then offsets may have already been
committed to Kafka, hence messages before that will not be consumed.
Guozhang
On Mon, Jun 23, 2014 at 6:09 PM, Li Li wrote:
> no luck by adding props.put("auto.offset.reset", "smallest");
> but running consumer
no luck by adding props.put("auto.offset.reset", "smallest");
but running consumer after producer works.
But in my use case, it's not alwasy true for this.
Another question, The consumer should remember the offset. it's not
very easy to use.
On Mon, Jun 23, 2014 at 11:05 PM, Guozhang Wang wrote:
for (final KafkaStream stream : streams) {
ConsumerIterator consumerIte = stream.iterator();
while (consumerIte.hasNext())
System.out.println("Message from Single Topic :: "
+ new String(consumerIte.next().
message()));
}
Besides what Guo
Did you start the consumer after the producer? The default behavior of the
consumer is to "consume from the tail of the log", and hence if there is no
new messages coming in after the consumer started, it will get nothing. You
may set
auto.offset.reset="smallest"
and try again.
Guozhang
On Sun
hi all,
I am reading the book "apache kafka" and write a simple producer
and consumer class. the producer works but the consumer hangs.
The producer class:
public static void main(String[] args) {
String topic="test-topic";
Properties props = new Properties();
props.put("metadata.