Package org.apache.pulsar.client.impl
Class ClientCnx
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.client.impl.ClientCnx
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
Channel handler for the Pulsar client.
Please see PulsarDecoder javadoc for important details about handle* method
parameter instance lifecycle.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Authenticationprotected AuthenticationDataProviderprotected final intprotected Stringprotected Stringprotected ClientCnx.StateFields inherited from class org.apache.pulsar.common.protocol.PulsarHandler
ctxFields inherited from class org.apache.pulsar.common.protocol.PulsarDecoder
proxyMessage -
Constructor Summary
ConstructorsConstructorDescriptionClientCnx(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup) ClientCnx(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, int protocolVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) voidchannelInactive(io.netty.channel.ChannelHandlerContext ctx) voidclose()protected voidio.netty.channel.ChannelHandlerContextctx()voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) longstatic PulsarClientExceptiongetPulsarClientException(ServerError error, String errorMsg) protected voidhandleAckResponse(CommandAckResponse ackResponse) protected voidprotected voidprotected voidprotected voidhandleAuthChallenge(CommandAuthChallenge authChallenge) protected voidhandleCloseConsumer(CommandCloseConsumer closeConsumer) protected voidhandleCloseProducer(CommandCloseProducer closeProducer) protected voidhandleCommandWatchTopicListSuccess(CommandWatchTopicListSuccess commandWatchTopicListSuccess) protected voidhandleCommandWatchTopicUpdate(CommandWatchTopicUpdate commandWatchTopicUpdate) protected voidhandleConnected(CommandConnected connected) protected voidprotected voidprotected voidprotected voidhandleError(CommandError error) protected voidprotected voidhandleGetOrCreateSchemaResponse(CommandGetOrCreateSchemaResponse commandGetOrCreateSchemaResponse) protected voidhandleGetSchemaResponse(CommandGetSchemaResponse commandGetSchemaResponse) protected voidprotected voidhandleLookupResponse(CommandLookupTopicResponse lookupResult) protected voidhandleMessage(CommandMessage cmdMessage, io.netty.buffer.ByteBuf headersAndPayload) protected voidprotected voidprotected voidprotected voidhandleReachedEndOfTopic(CommandReachedEndOfTopic commandReachedEndOfTopic) protected voidhandleSendError(CommandSendError sendError) protected voidhandleSendReceipt(CommandSendReceipt sendReceipt) protected voidhandleSuccess(CommandSuccess success) protected voidprotected voidhandleTopicMigrated(CommandTopicMigrated commandTopicMigrated) booleanCheck client connection is now free.protected booleanstatic booleannewAckForReceipt(io.netty.buffer.ByteBuf request, long requestId) voidnewAckForReceiptWithFuture(io.netty.buffer.ByteBuf request, long requestId, TimedCompletableFuture<Void> future) protected io.netty.buffer.ByteBufnewGetTopicsOfNamespace(io.netty.buffer.ByteBuf request, long requestId) newLookup(io.netty.buffer.ByteBuf request, long requestId) newWatchTopicList(BaseCommand commandWatchTopicList, long requestId) newWatchTopicListClose(BaseCommand commandWatchTopicListClose, long requestId) voidsendGetLastMessageId(io.netty.buffer.ByteBuf request, long requestId) CompletableFuture<byte[]>sendGetOrCreateSchema(io.netty.buffer.ByteBuf request, long requestId) sendGetRawSchema(io.netty.buffer.ByteBuf request, long requestId) sendGetSchema(io.netty.buffer.ByteBuf request, long requestId) 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
channelRead, handleAck, handleAddPartitionToTxn, handleAddSubscriptionToTxn, handleAuthResponse, handleCommandWatchTopicList, handleCommandWatchTopicListClose, handleConnect, handleConsumerStats, handleConsumerStatsResponse, handleEndTxn, handleEndTxnOnPartition, handleEndTxnOnSubscription, handleFlow, handleGetLastMessageId, handleGetOrCreateSchema, handleGetSchema, handleGetTopicsOfNamespace, handleLookup, handleNewTxn, handlePartitionMetadataRequest, handleProducer, handleRedeliverUnacknowledged, handleSeek, handleSend, handleSubscribe, handleTcClientConnectRequest, handleUnsubscribe, interceptCommandMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, 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
-
authentication
-
state
-
protocolVersion
protected final int protocolVersion -
proxyToTargetBrokerAddress
-
remoteHostName
-
authenticationDataProvider
-
-
Constructor Details
-
ClientCnx
-
ClientCnx
public ClientCnx(ClientConfigurationData conf, io.netty.channel.EventLoopGroup eventLoopGroup, int protocolVersion)
-
-
Method Details
-
channelActive
- Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classPulsarHandler- Throws:
Exception
-
newConnectCommand
- 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
-
isKnownException
-
getDuplicatedResponseCount
public long getDuplicatedResponseCount() -
handleConnected
- Overrides:
handleConnectedin classPulsarDecoder
-
handleAuthChallenge
- Overrides:
handleAuthChallengein classPulsarDecoder
-
handleSendReceipt
- Overrides:
handleSendReceiptin classPulsarDecoder
-
handleAckResponse
- Overrides:
handleAckResponsein classPulsarDecoder
-
handleMessage
- Overrides:
handleMessagein classPulsarDecoder
-
handleActiveConsumerChange
- Overrides:
handleActiveConsumerChangein classPulsarDecoder
-
handleSuccess
- Overrides:
handleSuccessin classPulsarDecoder
-
handleGetLastMessageIdSuccess
- Overrides:
handleGetLastMessageIdSuccessin classPulsarDecoder
-
handleProducerSuccess
- Overrides:
handleProducerSuccessin classPulsarDecoder
-
handleLookupResponse
- Overrides:
handleLookupResponsein classPulsarDecoder
-
handlePartitionResponse
- Overrides:
handlePartitionResponsein classPulsarDecoder
-
handleReachedEndOfTopic
- Overrides:
handleReachedEndOfTopicin classPulsarDecoder
-
handleTopicMigrated
- Overrides:
handleTopicMigratedin classPulsarDecoder
-
handleSendError
- Overrides:
handleSendErrorin classPulsarDecoder
-
handleError
- Overrides:
handleErrorin classPulsarDecoder
-
handleCloseProducer
- Overrides:
handleCloseProducerin classPulsarDecoder
-
handleCloseConsumer
- Overrides:
handleCloseConsumerin classPulsarDecoder
-
isHandshakeCompleted
protected boolean isHandshakeCompleted()- Specified by:
isHandshakeCompletedin classPulsarHandler
-
newLookup
public CompletableFuture<BinaryProtoLookupService.LookupDataResult> newLookup(io.netty.buffer.ByteBuf request, long requestId) -
newGetTopicsOfNamespace
public CompletableFuture<GetTopicsResult> newGetTopicsOfNamespace(io.netty.buffer.ByteBuf request, long requestId) -
newAckForReceipt
-
newAckForReceiptWithFuture
public void newAckForReceiptWithFuture(io.netty.buffer.ByteBuf request, long requestId, TimedCompletableFuture<Void> future) -
handleGetTopicsOfNamespaceSuccess
- Overrides:
handleGetTopicsOfNamespaceSuccessin classPulsarDecoder
-
handleGetSchemaResponse
- Overrides:
handleGetSchemaResponsein classPulsarDecoder
-
handleGetOrCreateSchemaResponse
protected void handleGetOrCreateSchemaResponse(CommandGetOrCreateSchemaResponse commandGetOrCreateSchemaResponse) - Overrides:
handleGetOrCreateSchemaResponsein classPulsarDecoder
-
ctx
public io.netty.channel.ChannelHandlerContext ctx() -
sendGetLastMessageId
public CompletableFuture<CommandGetLastMessageIdResponse> sendGetLastMessageId(io.netty.buffer.ByteBuf request, long requestId) -
sendGetSchema
public CompletableFuture<Optional<SchemaInfo>> sendGetSchema(io.netty.buffer.ByteBuf request, long requestId) -
sendGetRawSchema
public CompletableFuture<CommandGetSchemaResponse> sendGetRawSchema(io.netty.buffer.ByteBuf request, long requestId) -
sendGetOrCreateSchema
public CompletableFuture<byte[]> sendGetOrCreateSchema(io.netty.buffer.ByteBuf request, long requestId) -
handleNewTxnResponse
- Overrides:
handleNewTxnResponsein classPulsarDecoder
-
handleAddPartitionToTxnResponse
- Overrides:
handleAddPartitionToTxnResponsein classPulsarDecoder
-
handleAddSubscriptionToTxnResponse
- Overrides:
handleAddSubscriptionToTxnResponsein classPulsarDecoder
-
handleEndTxnOnPartitionResponse
- Overrides:
handleEndTxnOnPartitionResponsein classPulsarDecoder
-
handleEndTxnOnSubscriptionResponse
- Overrides:
handleEndTxnOnSubscriptionResponsein classPulsarDecoder
-
handleEndTxnResponse
- Overrides:
handleEndTxnResponsein classPulsarDecoder
-
handleTcClientConnectResponse
- Overrides:
handleTcClientConnectResponsein classPulsarDecoder
-
newWatchTopicList
public CompletableFuture<CommandWatchTopicListSuccess> newWatchTopicList(BaseCommand commandWatchTopicList, long requestId) -
newWatchTopicListClose
public CompletableFuture<CommandSuccess> newWatchTopicListClose(BaseCommand commandWatchTopicListClose, long requestId) -
handleCommandWatchTopicListSuccess
protected void handleCommandWatchTopicListSuccess(CommandWatchTopicListSuccess commandWatchTopicListSuccess) - Overrides:
handleCommandWatchTopicListSuccessin classPulsarDecoder
-
handleCommandWatchTopicUpdate
- Overrides:
handleCommandWatchTopicUpdatein classPulsarDecoder
-
registerTransactionBufferHandler
-
getPulsarClientException
-
close
public void close() -
closeWithException
-
idleCheck
public boolean idleCheck()Check client connection is now free. This method will not change the state to idle.- Returns:
- true if the connection is eligible.
-