Re: How to get and reset Kafka stream application's offsets

2016-12-28 Thread Matthias J. Sax
Exactly. On 12/28/16 10:47 AM, Sachin Mittal wrote: > Understood. So if we want it to start consuming from earliest we should add > props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); > > So when we start the app first time it will start from earliest. Later when > we stop this app a

Re: How to get and reset Kafka stream application's offsets

2016-12-28 Thread Sachin Mittal
Understood. So if we want it to start consuming from earliest we should add props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); So when we start the app first time it will start from earliest. Later when we stop this app and restart it will start from point where we has last committed

Re: How to get and reset Kafka stream application's offsets

2016-12-28 Thread Matthias J. Sax
Hi Sachin, What do you mean by "with this commented"? Did you set auto.offset.reset to "earliest" or not? Default value is "latest" and if you do not set it to "earliest", that the application will start consuming from end-of-topic if no committed offsets are found. For default values of Kafka St

Re: How to get and reset Kafka stream application's offsets

2016-12-27 Thread Sachin Mittal
Hi, I started my new streams app with this commented //props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest"); What I observed was that it started consuming message from latest offset from the source topic. Based on comments by Eno I thought that if offset do not exist then So in practice

Re: How to get and reset Kafka stream application's offsets

2016-11-21 Thread Matthias J. Sax
One more thing to add: You could build an own tool to set specific offsets for each partition. The mentioned reset tool does something similar, setting the offset for all partitions to zero. But you could just copy the code and enhance it to set arbitrary offsets for each partition. However, for

Re: How to get and reset Kafka stream application's offsets

2016-11-21 Thread Eno Thereska
Hi Sachin, There is no need to check within the app whether the offset exists or not, since the consumer code will do that check automatically for you. So in practice an app will include the property below (e.g., set to "earliest"), but that will only have an effect if the consumer detects that

Re: How to get and reset Kafka stream application's offsets

2016-11-21 Thread Sachin Mittal
So in my java code how can I check when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted) So in this case as you have said I can set offset as props.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

Re: How to get and reset Kafka stream application's offsets

2016-11-21 Thread Eno Thereska
Hi Sachin, Currently you can only change the following global configuration by using "earliest" or "latest", as shown in the code snippet below. As the Javadoc mentions: "What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. bec