1. This is true, you need to synchronize these consumer threads when
2. If you are asking what if the consumer thread crashed after
within the next() call, then on its startup, it will lose all these
in-memory offsets, and read from the ZK which will be smaller than the
current value, still leading to duplicates but not data losses.
On Wed, Jan 29, 2014 at 12:31 PM, Clark Breyman <[EMAIL PROTECTED]> wrote:
> Thank make sense except for the following:
> - the ZookeeperConsumerConnector.commitOffsets() method commits the current
> value of PartitionTopicInfo.consumeOffset for all of the active streams.
> - the ConsumerIterator in the streams advances the value of
> PartitionTopicInfo.consumeOffset *before* next() returns, not after the
> processing on that message is complete.
> If you have multiple threads consuming, thread A calling commitOffsets()
> may commit thread B's retrieved but unprocessed message, no?
> On Wed, Jan 29, 2014 at 12:20 PM, Guozhang Wang <[EMAIL PROTECTED]>
> > Hi Clark,
> > In practice, the client app code need to always commit offset after it
> > processed the messages, and hence only the second case may happen,
> > to "at least once".
> > Guozhang
> > On Wed, Jan 29, 2014 at 11:51 AM, Clark Breyman <[EMAIL PROTECTED]>
> > > Wrestling through the at-least/most-once semantics of my application
> > I
> > > was hoping for some confirmation of the semantics. I'm not sure I can
> > > classify the high level consumer as either type.
> > >
> > > False ack scenario:
> > > - Thread A: call next() on the ConsumerIterator, advancing the
> > > PartitionTopicInfo offset
> > > - Thread B: commitOffsets() flushed offset of incomplete message to ZK
> > > - Thread A: fail processing (e.g. kill -9)
> > >
> > > False retry scenario:
> > > - Thread A: call next() & successfully process, kill -9 before
> > > commitOffsets either in thread or in parallel.
> > >
> > > Is this right or am I missing something (likely)? Seems like the
> > semantics
> > > are essentially approximately once.
> > >
> > --
> > -- Guozhang