It is not easy to get the fetcher thread id from kafka stream. We do have the mapping as a topicThreadIdAndQueues, but it is private to the consumer and not exposed to callers.
Guozhang On Fri, Jun 6, 2014 at 9:00 AM, Bogdan Dimitriu (bdimitri) < bdimi...@cisco.com> wrote: > I see. And can I somehow reliably get the ID of the fetcher thread that is > providing data for a KafkaStream? Specifically I¹d like to know that ID > from the thread where I¹m consuming (where I iterate through the stream). > > Thank you, > Bogdan > > On 06/06/2014 16:16, "Guozhang Wang" <wangg...@gmail.com> wrote: > > >Bogdan, > > > >The kafka stream does not have an ID itself, the one you mentioned is the > >ID of the fetcher thread that put data into the stream. Although there is > >a > >one-to-one mapping between the fetcher thread and the stream, the Ids of > >the fetcher cannot be accessed from the kafka stream itself. > > > >Guozhang > > > > > >On Fri, Jun 6, 2014 at 2:13 AM, Bogdan Dimitriu (bdimitri) < > >bdimi...@cisco.com> wrote: > > > >> Hello folks, > >> > >> I¹m using Kafka 0.8.0 with the high level consumer and I have a > >>situation > >> where I need to obtain the ID for each of the KafkaStreams that I > >>create. > >> The KafkaStream class has a method called ³clientId()² that I expected > >> would give me just that, but unfortunately it returns the name of the > >> consumer group. > >> So to make it clear, what I want to obtain is the string that looks like > >> this: myconsumergroup_myhost-1402045464004-2dc0cbf2-0. > >> Is there any way I could get that value for each of the streams? I¹ve > >> looked around the source code but I can¹t see any way to do this. > >> > >> Many thanks, > >> Bogdan > >> > >> > > > > > >-- > >-- Guozhang > > -- -- Guozhang