Chris
Chris

Reputation: 1349

Kafka Streams Get Client Id in Processor API

Is there a way to get the client id in a processor? My thought is it maybe able to be built with info in the processor context?

For example, "my_app-e2e751f2-7c99-484d-9a5b-172de63bc6e1-StreamThread-1"

The reason for this I want to add new metrics to the existing location.

kafka.streams->my_app-e2e751f2-7c99-484d-9a5b-172de63bc6e1-StreamThread-1->*

Upvotes: 1

Views: 585

Answers (1)

miguno
miguno

Reputation: 15057

Is there a way to get the client id in a processor?

You can access the application.id (which represents the Kafka consumer group ID used by your Kafka Streams application) as well as the stream task id via the ProcessorContext:

ProcessorContext#applicationId()
ProcessorContext#taskId()

See the Apache Kafka 2.1 docs for more information:

Is that what you need?

Upvotes: 1

Related Questions