Hi!

On Sat, May 5, 2012 at 11:44 PM, S Ahmed <sahmed1...@gmail.com> wrote:
> c = Kafka::Consumer.new(:topic => "test")
> m1 = c.consume
> []
>
> So it says it is empty.

The Ruby-Consumer consumes everything after it was started (in
lib/kafka/consumer.rb you can see that the offset is automatically set
to latest_offset on startup).
You can set your own offset in the Consumer's constructor like
Kafka::Consumer.new(:offset => 12345) if you want.

To receive messages via the normal consume-method you'd have to create
them after the consumer was instantiated, so like:
c = Kafka::Consumer.new(:topic => "test")
# now run the producer
m1 = c.consume
# m1 now contains the newly created messages


Sebastian

Reply via email to