Package org.apache.pulsar.proxy.server
Class ProxyConnection
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.apache.pulsar.common.protocol.PulsarDecoder
org.apache.pulsar.common.protocol.PulsarHandler
org.apache.pulsar.proxy.server.ProxyConnection
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
Handles incoming discovery request from client and sends appropriate response back to client.
Please see PulsarDecoder javadoc for important details about handle* method
parameter instance lifecycle.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsFields inherited from class org.apache.pulsar.common.protocol.PulsarHandler
ctx, remoteAddressFields inherited from class org.apache.pulsar.common.protocol.PulsarDecoder
proxyMessage -
Constructor Summary
ConstructorsConstructorDescriptionProxyConnection(ProxyService proxyService, io.netty.resolver.dns.DnsAddressResolverGroup dnsAddressResolverGroup) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidauthChallengeSuccessCallback(org.apache.pulsar.common.api.AuthData authChallenge) protected voidvoidbrokerConnected(DirectProxyHandler directProxyHandler, CommandConnected connected) voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidchannelRegistered(io.netty.channel.ChannelHandlerContext ctx) voidchannelUnregistered(io.netty.channel.ChannelHandlerContext ctx) voidchannelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) io.netty.handler.codec.haproxy.HAProxyMessageprotected voidhandleAuthResponse(CommandAuthResponse authResponse) protected voidhandleConnect(CommandConnect connect) protected voidhandleGetSchema(CommandGetSchema commandGetSchema) protected voidhandleGetTopicsOfNamespace(CommandGetTopicsOfNamespace commandGetTopicsOfNamespace) protected voidhandleLookup(CommandLookupTopic lookup) handles discovery request from client ands sends next active broker address.protected voidhandlePartitionMetadataRequest(CommandPartitionedTopicMetadata partitionMetadata) booleanprotected booleanprotected static booleanisTlsChannel(io.netty.channel.Channel channel) protected static io.netty.channel.ChannelPromisespliceNIC2NIC(io.netty.channel.epoll.EpollSocketChannel inboundChannel, io.netty.channel.epoll.EpollSocketChannel outboundChannel, int spliceLength) Use splice to zero-copy of NIC to NIC.Methods inherited from class org.apache.pulsar.common.protocol.PulsarHandler
cancelKeepAliveTask, getRemoteEndpointProtocolVersion, handlePing, handlePong, messageReceived, sendPing, setRemoteEndpointProtocolVersionMethods inherited from class org.apache.pulsar.common.protocol.PulsarDecoder
handleAck, handleAckResponse, handleActiveConsumerChange, handleAddPartitionToTxn, handleAddPartitionToTxnResponse, handleAddSubscriptionToTxn, handleAddSubscriptionToTxnResponse, handleAuthChallenge, handleCloseConsumer, handleCloseProducer, handleCommandWatchTopicList, handleCommandWatchTopicListClose, handleCommandWatchTopicListSuccess, handleCommandWatchTopicUpdate, handleConnected, handleConsumerStats, handleConsumerStatsResponse, handleEndTxn, handleEndTxnOnPartition, handleEndTxnOnPartitionResponse, handleEndTxnOnSubscription, handleEndTxnOnSubscriptionResponse, handleEndTxnResponse, handleError, handleFlow, handleGetLastMessageId, handleGetLastMessageIdSuccess, handleGetOrCreateSchema, handleGetOrCreateSchemaResponse, handleGetSchemaResponse, handleGetTopicsOfNamespaceSuccess, handleLookupResponse, handleMessage, handleNewTxn, handleNewTxnResponse, handlePartitionResponse, handleProducer, handleProducerSuccess, handleReachedEndOfTopic, handleRedeliverUnacknowledged, handleSeek, handleSend, handleSendError, handleSendReceipt, handleSubscribe, handleSuccess, handleTcClientConnectRequest, handleTcClientConnectResponse, handleTopicMigrated, handleUnsubscribe, interceptCommandMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
SPLICE_BYTES
-
-
Constructor Details
-
ProxyConnection
public ProxyConnection(ProxyService proxyService, io.netty.resolver.dns.DnsAddressResolverGroup dnsAddressResolverGroup)
-
-
Method Details
-
channelRegistered
- Specified by:
channelRegisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelRegisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelUnregistered
- Specified by:
channelUnregisteredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelUnregisteredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelActive
- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classPulsarHandler- Throws:
Exception
-
channelInactive
- Specified by:
channelInactivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelInactivein classPulsarHandler- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelWritabilityChanged
- Specified by:
channelWritabilityChangedin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelWritabilityChangedin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classPulsarDecoder- Throws:
Exception
-
spliceNIC2NIC
protected static io.netty.channel.ChannelPromise spliceNIC2NIC(io.netty.channel.epoll.EpollSocketChannel inboundChannel, io.netty.channel.epoll.EpollSocketChannel outboundChannel, int spliceLength) Use splice to zero-copy of NIC to NIC.- Parameters:
inboundChannel- input channeloutboundChannel- output channel
-
isTlsChannel
protected static boolean isTlsChannel(io.netty.channel.Channel channel) -
brokerConnected
-
authenticationFailedCallback
-
authChallengeSuccessCallback
protected void authChallengeSuccessCallback(org.apache.pulsar.common.api.AuthData authChallenge) -
handleConnect
- Overrides:
handleConnectin classPulsarDecoder
-
handleAuthResponse
- Overrides:
handleAuthResponsein classPulsarDecoder
-
handlePartitionMetadataRequest
- Overrides:
handlePartitionMetadataRequestin classPulsarDecoder
-
handleGetTopicsOfNamespace
- Overrides:
handleGetTopicsOfNamespacein classPulsarDecoder
-
handleGetSchema
- Overrides:
handleGetSchemain classPulsarDecoder
-
handleLookup
handles discovery request from client ands sends next active broker address.- Overrides:
handleLookupin classPulsarDecoder
-
getClientAuthentication
-
isHandshakeCompleted
protected boolean isHandshakeCompleted()- Specified by:
isHandshakeCompletedin classPulsarHandler
-
hasHAProxyMessage
public boolean hasHAProxyMessage() -
getHAProxyMessage
public io.netty.handler.codec.haproxy.HAProxyMessage getHAProxyMessage()
-