blob: 84ca25e75b2ffa4730485e04650d121bc36e9921 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>ClientQuotaCallback (kafka 3.0.0 API)</title>
<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 data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "alt-color";
var rowColor = "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">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">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" 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="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>
<pre>public interface <span class="type-name-label">ClientQuotaCallback</span>
extends <a href="../../common/Configurable.html" title="interface in org.apache.kafka.common">Configurable</a></pre>
<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 class="member-summary" id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" id="t0" class="active-table-tab">All Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t2" class="table-tab" onclick="show(2);">Instance Methods</button><button role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" id="t3" class="table-tab" onclick="show(4);">Abstract Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<table class="summary-table" aria-labelledby="t0">
<thead>
<tr>
<th class="col-first" scope="col">Modifier and Type</th>
<th class="col-second" scope="col">Method</th>
<th class="col-last" scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr class="alt-color" id="i0">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#close()">close</a></span>()</code></th>
<td class="col-last">
<div class="block">Closes this instance.</div>
</td>
</tr>
<tr class="row-color" id="i1">
<td class="col-first"><code><a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a></code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#quotaLimit(org.apache.kafka.server.quota.ClientQuotaType,java.util.Map)">quotaLimit</a></span>&#8203;(<a href="ClientQuotaType.html" title="enum in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="https://docs.oracle.com/en/java/javase/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;&nbsp;metricTags)</code></th>
<td class="col-last">
<div class="block">Returns the quota limit associated with the provided metric tags.</div>
</td>
</tr>
<tr class="alt-color" id="i2">
<td class="col-first"><code><a href="https://docs.oracle.com/en/java/javase/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#quotaMetricTags(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.common.security.auth.KafkaPrincipal,java.lang.String)">quotaMetricTags</a></span>&#8203;(<a href="ClientQuotaType.html" title="enum 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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;clientId)</code></th>
<td class="col-last">
<div class="block">Quota callback invoked to determine the quota metric tags to be applied for a request.</div>
</td>
</tr>
<tr class="row-color" id="i3">
<td class="col-first"><code>boolean</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#quotaResetRequired(org.apache.kafka.server.quota.ClientQuotaType)">quotaResetRequired</a></span>&#8203;(<a href="ClientQuotaType.html" title="enum in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType)</code></th>
<td class="col-last">
<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>
</td>
</tr>
<tr class="alt-color" id="i4">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#removeQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity)">removeQuota</a></span>&#8203;(<a href="ClientQuotaType.html" title="enum 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></th>
<td class="col-last">
<div class="block">Quota configuration removal callback that is invoked when quota configuration for an entity is
removed in ZooKeeper.</div>
</td>
</tr>
<tr class="row-color" id="i5">
<td class="col-first"><code>boolean</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#updateClusterMetadata(org.apache.kafka.common.Cluster)">updateClusterMetadata</a></span>&#8203;(<a href="../../common/Cluster.html" title="class in org.apache.kafka.common">Cluster</a>&nbsp;cluster)</code></th>
<td class="col-last">
<div class="block">Metadata update callback that is invoked whenever UpdateMetadata request is received from
the controller.</div>
</td>
</tr>
<tr class="alt-color" id="i6">
<td class="col-first"><code>void</code></td>
<th class="col-second" scope="row"><code><span class="member-name-link"><a href="#updateQuota(org.apache.kafka.server.quota.ClientQuotaType,org.apache.kafka.server.quota.ClientQuotaEntity,double)">updateQuota</a></span>&#8203;(<a href="ClientQuotaType.html" title="enum 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></th>
<td class="col-last">
<div class="block">Quota configuration update callback that is invoked when quota configuration for an entity is
updated in ZooKeeper.</div>
</td>
</tr>
</tbody>
</table>
</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/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/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="member-name">quotaMetricTags</span>&#8203;(<span class="parameters"><a href="ClientQuotaType.html" title="enum 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/15/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/15/docs/api/java.base/java/lang/Double.html" title="class or interface in java.lang" class="external-link">Double</a></span>&nbsp;<span class="member-name">quotaLimit</span>&#8203;(<span class="parameters"><a href="ClientQuotaType.html" title="enum in org.apache.kafka.server.quota">ClientQuotaType</a>&nbsp;quotaType,
<a href="https://docs.oracle.com/en/java/javase/15/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/15/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,&#8203;<a href="https://docs.oracle.com/en/java/javase/15/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="member-name">updateQuota</span>&#8203;(<span class="parameters"><a href="ClientQuotaType.html" title="enum 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 ZooKeeper. 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="member-name">removeQuota</span>&#8203;(<span class="parameters"><a href="ClientQuotaType.html" title="enum 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 ZooKeeper. 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="member-name">quotaResetRequired</span>&#8203;(<span class="parameters"><a href="ClientQuotaType.html" title="enum 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="member-name">updateClusterMetadata</span>&#8203;(<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="member-name">close</span>()</div>
<div class="block">Closes this instance.</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottom-nav" id="navbar.bottom">
<div class="skip-nav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar.bottom.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">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>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<span class="skip-nav" id="skip.navbar.bottom">
<!-- -->
</span></nav>
</footer>
</div>
</div>
</body>
</html>