blob: 4ae51484779ddf1eaaa0b2e38d1eb01ffe235250 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>ClientQuotaCallback (kafka 3.5.2 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.kafka.server.quota, interface: ClientQuotaCallback">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.kafka.server.quota</a></div>
<h1 title="Interface ClientQuotaCallback" class="title">Interface ClientQuotaCallback</h1>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>All Superinterfaces:</dt>
<dd><code><a href="../../common/Configurable.html" title="interface in org.apache.kafka.common">Configurable</a></code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">ClientQuotaCallback</span><span class="extends-implements">
extends <a href="../../common/Configurable.html" title="interface in org.apache.kafka.common">Configurable</a></span></div>
<div class="block">Quota callback interface for brokers that enables customization of client quota computation.</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#close()" class="member-name-link">close</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Closes this instance.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#quotaLimit(org.apache.kafka.server.quota.ClientQuotaType,java.util.Map)" class="member-name-link">quotaLimit</a><wbr>(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;&nbsp;metricTags)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns the quota limit associated with the provided metric tags.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#quotaMetricTags(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.common.security.auth.KafkaPrincipal,java.lang.String)" class="member-name-link">quotaMetricTags</a><wbr>(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="../../common/security/auth/KafkaPrincipal.html" title="class in org.apache.kafka.common.security.auth">KafkaPrincipal</a>&nbsp;principal,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;clientId)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Quota callback invoked to determine the quota metric tags to be applied for a request.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#quotaResetRequired(org.apache.kafka.server.quota.ClientQuotaType)" class="member-name-link">quotaResetRequired</a><wbr>(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Returns true if any of the existing quota configs may have been updated since the last call
to this method for the provided quota type.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#removeQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity)" class="member-name-link">removeQuota</a><wbr>(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="ClientQuotaEntity.html" title="interface in org.apache.kafka.server.quota">ClientQuotaEntity</a>&nbsp;quotaEntity)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Quota configuration removal callback that is invoked when quota configuration for an entity is
removed in the quorum.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#updateClusterMetadata(org.apache.kafka.common.Cluster)" class="member-name-link">updateClusterMetadata</a><wbr>(<a href="../../common/Cluster.html" title="class in org.apache.kafka.common">Cluster</a>&nbsp;cluster)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Metadata update callback that is invoked whenever UpdateMetadata request is received from
the controller.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#updateQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity,double)" class="member-name-link">updateQuota</a><wbr>(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="ClientQuotaEntity.html" title="interface in org.apache.kafka.server.quota">ClientQuotaEntity</a>&nbsp;quotaEntity,
double&nbsp;newValue)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Quota configuration update callback that is invoked when quota configuration for an entity is
updated in the quorum.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-org.apache.kafka.common.Configurable">Methods inherited from interface&nbsp;org.apache.kafka.common.<a href="../../common/Configurable.html" title="interface in org.apache.kafka.common">Configurable</a></h3>
<code><a href="../../common/Configurable.html#configure(java.util.Map)">configure</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="quotaMetricTags(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.common.security.auth.KafkaPrincipal,java.lang.String)">
<h3>quotaMetricTags</h3>
<div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</span>&nbsp;<span class="element-name">quotaMetricTags</span><wbr><span class="parameters">(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="../../common/security/auth/KafkaPrincipal.html" title="class in org.apache.kafka.common.security.auth">KafkaPrincipal</a>&nbsp;principal,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;clientId)</span></div>
<div class="block">Quota callback invoked to determine the quota metric tags to be applied for a request.
Quota limits are associated with quota metrics and all clients which use the same
metric tags share the quota limit.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>quotaType</code> - Type of quota requested</dd>
<dd><code>principal</code> - The user principal of the connection for which quota is requested</dd>
<dd><code>clientId</code> - The client id associated with the request</dd>
<dt>Returns:</dt>
<dd>quota metric tags that indicate which other clients share this quota</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="quotaLimit(org.apache.kafka.server.quota.ClientQuotaType,java.util.Map)">
<h3>quotaLimit</h3>
<div class="member-signature"><span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a></span>&nbsp;<span class="element-name">quotaLimit</span><wbr><span class="parameters">(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Map.html" title="class or interface in java.util" class="external-link">Map</a>&lt;<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;&nbsp;metricTags)</span></div>
<div class="block">Returns the quota limit associated with the provided metric tags. These tags were returned from
a previous call to <a href="#quotaMetricTags(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.common.security.auth.KafkaPrincipal,java.lang.String)"><code>quotaMetricTags(ClientQuotaType, KafkaPrincipal, String)</code></a>. This method is
invoked by quota managers to obtain the current quota limit applied to a metric when the first request
using these tags is processed. It is also invoked after a quota update or cluster metadata change.
If the tags are no longer in use after the update, (e.g. this is a {user, client-id} quota metric
and the quota now in use is a {user} quota), null is returned.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>quotaType</code> - Type of quota requested</dd>
<dd><code>metricTags</code> - Metric tags for a quota metric of type `quotaType`</dd>
<dt>Returns:</dt>
<dd>the quota limit for the provided metric tags or null if the metric tags are no longer in use</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="updateQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity,double)">
<h3>updateQuota</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">updateQuota</span><wbr><span class="parameters">(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="ClientQuotaEntity.html" title="interface in org.apache.kafka.server.quota">ClientQuotaEntity</a>&nbsp;quotaEntity,
double&nbsp;newValue)</span></div>
<div class="block">Quota configuration update callback that is invoked when quota configuration for an entity is
updated in the quorum. This is useful to track configured quotas if built-in quota configuration
tools are used for quota management.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>quotaType</code> - Type of quota being updated</dd>
<dd><code>quotaEntity</code> - The quota entity for which quota is being updated</dd>
<dd><code>newValue</code> - The new quota value</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="removeQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity)">
<h3>removeQuota</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">removeQuota</span><wbr><span class="parameters">(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="ClientQuotaEntity.html" title="interface in org.apache.kafka.server.quota">ClientQuotaEntity</a>&nbsp;quotaEntity)</span></div>
<div class="block">Quota configuration removal callback that is invoked when quota configuration for an entity is
removed in the quorum. This is useful to track configured quotas if built-in quota configuration
tools are used for quota management.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>quotaType</code> - Type of quota being updated</dd>
<dd><code>quotaEntity</code> - The quota entity for which quota is being updated</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="quotaResetRequired(org.apache.kafka.server.quota.ClientQuotaType)">
<h3>quotaResetRequired</h3>
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name">quotaResetRequired</span><wbr><span class="parameters">(<a href="ClientQuotaType.html" title="enum class in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType)</span></div>
<div class="block">Returns true if any of the existing quota configs may have been updated since the last call
to this method for the provided quota type. Quota updates as a result of calls to
<a href="#updateClusterMetadata(org.apache.kafka.common.Cluster)"><code>updateClusterMetadata(Cluster)</code></a>, <a href="#updateQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity,double)"><code>updateQuota(ClientQuotaType, ClientQuotaEntity, double)</code></a>
and <a href="#removeQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity)"><code>removeQuota(ClientQuotaType, ClientQuotaEntity)</code></a> are automatically processed.
So callbacks that rely only on built-in quota configuration tools always return false. Quota callbacks
with external quota configuration or custom reconfigurable quota configs that affect quota limits must
return true if existing metric configs may need to be updated. This method is invoked on every request
and hence is expected to be handled by callbacks as a simple flag that is updated when quotas change.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>quotaType</code> - Type of quota</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="updateClusterMetadata(org.apache.kafka.common.Cluster)">
<h3>updateClusterMetadata</h3>
<div class="member-signature"><span class="return-type">boolean</span>&nbsp;<span class="element-name">updateClusterMetadata</span><wbr><span class="parameters">(<a href="../../common/Cluster.html" title="class in org.apache.kafka.common">Cluster</a>&nbsp;cluster)</span></div>
<div class="block">Metadata update callback that is invoked whenever UpdateMetadata request is received from
the controller. This is useful if quota computation takes partitions into account.
Topics that are being deleted will not be included in `cluster`.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>cluster</code> - Cluster metadata including partitions and their leaders if known</dd>
<dt>Returns:</dt>
<dd>true if quotas have changed and metric configs may need to be updated</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="close()">
<h3>close</h3>
<div class="member-signature"><span class="return-type">void</span>&nbsp;<span class="element-name">close</span>()</div>
<div class="block">Closes this instance.</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</div>
</body>
</html>