kafka-dev / kafka

A distributed publish/subscribe messaging service
http://sna-projects.com/kafka
Apache License 2.0
549 stars 300 forks source link

Does KAFKA's custom quota callback provide a mechanism to enforce Quotas per KAFKA topic / client and to throw Exception instead of throttling. #95

Open Hussain-Badshah opened 6 months ago

Hussain-Badshah commented 6 months ago

Hi All,

I have a use case that I want to enforce the KAFKA Quotas per client but on per topic basis. The documentations say that the built-in kafka quotas cannot be applied on per topic basis, instead they will be applied on per broker basis only.

So we also have custom quota callback mechanism in place through which we can customize the Quota mechanism, as part of this KIP: https://cwiki.apache.org/confluence/display/KAFKA/KIP-257+-+Configurable+Quota+Management but I can't figure out 2 things:

  1. Right now, KAFKA throttles the client if it has reached the quota limit but my use case is not to throttle but to throw the exception for the produce request if the request is violating the quota. Can this be implemented using custom quota callback?
  2. Can custom quota callback be used to enforce quota on per topic basis?

I am unable to figure out answers to above 2 questions and any help would be really really appreciated. Thanks in advance.