Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # user >> kafka and ruby client, beginner questions


Copy link to this message
-
Re: kafka and ruby client, beginner questions
Is it possible to query for a list of offsets?

>From what I understand, each offset is not for a single message, but could
be a group of messages right?

On Mon, May 7, 2012 at 4:07 AM, Sebastian Eichner <[EMAIL PROTECTED]
> wrote:

> Hi!
>
> On Sat, May 5, 2012 at 11:44 PM, S Ahmed <[EMAIL PROTECTED]> 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
>