In 0.7, without producer ack, there is no easy way to ensure produced data reaches the server. For example, send.writeCompletely(channel) returns when the data is in socket buffer. If a broker goes down before producer's socket buffer is flushed, the data is lost and producer won't get any exceptions.
Thanks, Jun On Mon, Jun 25, 2012 at 11:49 PM, R S <mypostbo...@gmail.com> wrote: > Hi Jun , > > In the case mentioned below , in 0.7 if send (in SyncProducer) call is > complete without any exception does that mean message > has successfully reached the broker . > > from the code i see this > private def send(send: BoundedByteBufferSend) { > .............. > > try { > send.writeCompletely(channel) > } catch { > case e : java.io.IOException => > // no way to tell if write succeeded. Disconnect and re-throw > exception to let client handle retry > disconnect() > throw e > case e2 => > throw e2 > } > > Is there a way to know if the last offset has changed or not from Producer > side to make sure we do not send the new message again? > > -rks > > On Mon, Jun 25, 2012 at 8:52 PM, Jun Rao <jun...@gmail.com> wrote: > > > Tarun, > > > > In 0.7, there is no producer side ack. > > > > In 0.8, sync producer will wait for an ack and is blocking. If the ack is > > lost because a broker is down, sync producer will timeout and it's up to > > the caller to decide what to do. If the caller chooses to resend, it's > > possible for duplicated messages to show up in the broker. > > > > Thanks, > > > > Jun > > > > On Mon, Jun 25, 2012 at 8:12 AM, Tarun Kumar <agrawal.taru...@gmail.com > > >wrote: > > > > > Hi, > > > > > > I have a couple of questions related to Sync Producer. > > > > > > 1. From what i know (please correct me if i am wrong), Sync producer > send > > > is a blocking call. Until acknowledgement is received from broker, next > > > message is not sent by producer. > > > > > > 2. what if ack is lost. Is there any kind of timeout till when producer > > > waits for ack. If yes, does it try to resend same message? > > > If yes, duplicate message might reach to broker (due to previous > > message's > > > ack timeout). How does kafka avoids that? > > > > > > 3. What are different possibilities of duplicate messages being stored > at > > > broker? > > > > > > Thanks, > > > Tarun > > > > > >