Class NettyNioEchoServer
java.lang.Object
java.lang.Thread
org.apache.kafka.common.network.NioEchoServer
org.apache.kafka.common.network.netty.authenticator.NettyNioEchoServer
- All Implemented Interfaces:
Runnable
Analogous to the
NioEchoServer but implemented using Netty.
What this supports:
- SASLv0 authentication flow
- SASLv1 authentication flow
- Reauthentication flow
- Maximum receive size for authentication requests
- Metrics for authentications
- Audit logging
What this does not support:
- Proxy protocol parsing
- Async authentication
- Delay failed authentication handling-
Nested Class Summary
Nested classes/interfaces inherited from class NioEchoServer
NioEchoServer.MetricTypeNested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
Fields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionNettyNioEchoServer(org.apache.kafka.common.network.ListenerName listenerName, org.apache.kafka.common.security.auth.SecurityProtocol securityProtocol, org.apache.kafka.common.config.AbstractConfig config, String serverHost, org.apache.kafka.common.security.authenticator.CredentialCache credentialCache, int failedAuthenticationDelayMs, org.apache.kafka.common.utils.Time time, org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache tokenCache, Optional<org.apache.kafka.server.audit.AuditLogProvider> auditLogProvider, org.apache.kafka.common.network.ProxyProtocolEngineFactory proxyProtocolEngineFactory, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.network.ChannelBuilder channelBuilder) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()org.apache.kafka.common.security.authenticator.CredentialCacheorg.apache.kafka.common.metrics.Metricsmetrics()doublemetricValue(String name) doublemetricValue(String name, String mechanism) nioChannelsWithCredential(org.apache.kafka.common.network.PublicCredential matchingCredential) intport()org.apache.kafka.common.network.Selectableorg.apache.kafka.common.network.Selectorselector()voidsend(org.apache.kafka.common.network.NetworkSend send) voidstart()org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCachevoidverifyAuthenticationMetrics(int successfulAuthentications, int failedAuthentications) voidverifyAuthenticationMetricsForMechanism(int successfulAuthentications, int failedAuthentications, String mechanism) voidverifyAuthenticationMetricsForMechanism(int successfulAuthentications, int failedAuthentications, String mechanism, Set<NioEchoServer.MetricType> set) voidverifyReauthenticationMetrics(int successfulReauthentications, int failedReauthentications) voidwaitForMetric(String name, double expectedValue) voidwaitForMetrics(String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes) voidwaitForMetrics(String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes, String mechanism) Methods inherited from class NioEchoServer
closeKafkaChannels, closeNewChannels, closeSocketChannels, numSent, outputChannel, runMethods inherited from class Thread
activeCount, checkAccess, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, startVirtualThread, stop, threadId, toString, yield
-
Constructor Details
-
NettyNioEchoServer
public NettyNioEchoServer(org.apache.kafka.common.network.ListenerName listenerName, org.apache.kafka.common.security.auth.SecurityProtocol securityProtocol, org.apache.kafka.common.config.AbstractConfig config, String serverHost, org.apache.kafka.common.security.authenticator.CredentialCache credentialCache, int failedAuthenticationDelayMs, org.apache.kafka.common.utils.Time time, org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache tokenCache, Optional<org.apache.kafka.server.audit.AuditLogProvider> auditLogProvider, org.apache.kafka.common.network.ProxyProtocolEngineFactory proxyProtocolEngineFactory, org.apache.kafka.common.metrics.Metrics metrics, org.apache.kafka.common.network.ChannelBuilder channelBuilder) throws Exception - Throws:
Exception
-
-
Method Details
-
start
-
close
public void close()- Overrides:
closein classNioEchoServer
-
port
public int port()- Overrides:
portin classNioEchoServer
-
credentialCache
public org.apache.kafka.common.security.authenticator.CredentialCache credentialCache()- Overrides:
credentialCachein classNioEchoServer
-
tokenCache
public org.apache.kafka.common.security.token.delegation.internals.DelegationTokenCache tokenCache()- Overrides:
tokenCachein classNioEchoServer
-
metrics
public org.apache.kafka.common.metrics.Metrics metrics()- Overrides:
metricsin classNioEchoServer
-
selector
public org.apache.kafka.common.network.Selector selector()- Overrides:
selectorin classNioEchoServer
-
selectable
public org.apache.kafka.common.network.Selectable selectable()- Overrides:
selectablein classNioEchoServer
-
nioChannels
- Overrides:
nioChannelsin classNioEchoServer
-
nioChannelsWithCredential
public Collection<NioEchoChannel> nioChannelsWithCredential(org.apache.kafka.common.network.PublicCredential matchingCredential) - Overrides:
nioChannelsWithCredentialin classNioEchoServer
-
metricValue
- Overrides:
metricValuein classNioEchoServer
-
metricValue
- Overrides:
metricValuein classNioEchoServer
-
verifyAuthenticationMetrics
public void verifyAuthenticationMetrics(int successfulAuthentications, int failedAuthentications) throws InterruptedException - Overrides:
verifyAuthenticationMetricsin classNioEchoServer- Throws:
InterruptedException
-
verifyReauthenticationMetrics
public void verifyReauthenticationMetrics(int successfulReauthentications, int failedReauthentications) throws InterruptedException - Overrides:
verifyReauthenticationMetricsin classNioEchoServer- Throws:
InterruptedException
-
verifyAuthenticationMetricsForMechanism
public void verifyAuthenticationMetricsForMechanism(int successfulAuthentications, int failedAuthentications, String mechanism) throws InterruptedException - Overrides:
verifyAuthenticationMetricsForMechanismin classNioEchoServer- Throws:
InterruptedException
-
verifyAuthenticationMetricsForMechanism
public void verifyAuthenticationMetricsForMechanism(int successfulAuthentications, int failedAuthentications, String mechanism, Set<NioEchoServer.MetricType> set) throws InterruptedException - Overrides:
verifyAuthenticationMetricsForMechanismin classNioEchoServer- Throws:
InterruptedException
-
waitForMetric
- Overrides:
waitForMetricin classNioEchoServer- Throws:
InterruptedException
-
waitForMetrics
public void waitForMetrics(String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes) throws InterruptedException - Overrides:
waitForMetricsin classNioEchoServer- Throws:
InterruptedException
-
waitForMetrics
public void waitForMetrics(String namePrefix, double expectedValue, Set<NioEchoServer.MetricType> metricTypes, String mechanism) throws InterruptedException - Overrides:
waitForMetricsin classNioEchoServer- Throws:
InterruptedException
-
send
- Overrides:
sendin classNioEchoServer- Throws:
IOException
-