Also I don’t think you need to try the TopicMetadataRequest when auto.create.topics.enable=true, explicitly. I suppose if you try to produce using a topic name Kafka should automatically create the topic for you.
Thanks, Mayuresh On Jan 13, 2015, at 2:28 PM, Henri Pihkala <henri.pihk...@streamr.com> wrote: > Hi, > > Thanks for your reply, Guozhang, you are right. > > I eventually got it working, but it required TWO changes to what I initially > tried: > > 1) Use OffsetRequest, not OffsetFetchRequest, like Guozhang pointed out. > > 2) Create topics by sending a TopicMetadataRequest and having > auto.create.topics.enable=true. Initially I tried to create topics explicitly > using AdminUtils.createTopic(), but this did not work for some reason! > > Do you think the problem I had in 2) is worth investigating or reporting > further? The gist below is a test case that passes as is, but if I change the > topic creation method to AdminUtils.createTopic() the test fails. Can anyone > explain why? > > https://gist.github.com/hpihkala/f93ef3dc4c08382df69e > <https://gist.github.com/hpihkala/f93ef3dc4c08382df69e> > > Best regards > Henri > > >> On 13.1.2015, at 19.34, Guozhang Wang <wangg...@gmail.com> wrote: >> >> Henri, >> >> FetchOffsetRequest is used for retrieving the last committed offset of a >> certain consumer group; for your use case you would send OffsetRequest. >> >> That said the error code is misleading, it may be a bug in not indicating >> the right error code. >> >> Guozhang >> >> >> On Fri, Jan 9, 2015 at 4:10 AM, Henri Pihkala <henri.pihk...@streamr.com> >> wrote: >> >>> (1) Create topic >>> (2) Send a FetchOffsetRequest for a partition in the new topic >>> >>> Results in error code 3, or UnknownTopicOrPartition. >>> >>> How can it be unknown, since I just created it? Shouldn’t it return 0, as >>> that’s the offset of the next (first) message? >>> >>> Is this a bug or a feature? Tried with both 0.8.1.1 and 0.8.2-beta >>> (single-node cluster). >>> >>> Best regards >>> Henri >>> >>> >> >> >> -- >> -- Guozhang >