public class ServerCnx extends org.apache.pulsar.common.protocol.PulsarHandler implements TransportCnx
| Constructor and Description |
|---|
ServerCnx(PulsarService pulsar) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancelPublishBufferLimiting() |
void |
cancelPublishRateLimiting() |
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) |
SocketAddress |
clientAddress() |
protected void |
close()
It closes the connection with client which triggers
channelInactive() which clears all producers and
consumers from connection-map |
void |
closeConsumer(Consumer consumer) |
void |
closeProducer(Producer producer) |
void |
completedSendOperation(boolean isNonPersistentTopic,
int msgSize) |
io.netty.channel.ChannelHandlerContext |
ctx() |
void |
disableCnxAutoRead() |
void |
enableCnxAutoRead() |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
void |
execute(Runnable runnable) |
AuthenticationDataSource |
getAuthenticationData() |
AuthenticationProvider |
getAuthenticationProvider() |
String |
getAuthMethod() |
String |
getAuthRole()
The security role for this connection
|
AuthenticationState |
getAuthState() |
BrokerService |
getBrokerService() |
String |
getClientVersion() |
PulsarCommandSender |
getCommandSender() |
org.apache.pulsar.common.util.collections.ConcurrentLongHashMap<CompletableFuture<Consumer>> |
getConsumers() |
io.netty.handler.codec.haproxy.HAProxyMessage |
getHAProxyMessage() |
long |
getMessagePublishBufferSize() |
String |
getPrincipal() |
org.apache.pulsar.common.util.collections.ConcurrentLongHashMap<CompletableFuture<Producer>> |
getProducers() |
SocketAddress |
getRemoteAddress() |
String |
getRole() |
org.apache.pulsar.broker.service.ServerCnx.State |
getState()
Helper method for testability
|
protected void |
handleAck(org.apache.pulsar.common.api.proto.PulsarApi.CommandAck ack) |
protected void |
handleAddPartitionToTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandAddPartitionToTxn command) |
protected void |
handleAddSubscriptionToTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandAddSubscriptionToTxn command) |
protected void |
handleAuthResponse(org.apache.pulsar.common.api.proto.PulsarApi.CommandAuthResponse authResponse) |
protected void |
handleCloseConsumer(org.apache.pulsar.common.api.proto.PulsarApi.CommandCloseConsumer closeConsumer) |
protected void |
handleCloseProducer(org.apache.pulsar.common.api.proto.PulsarApi.CommandCloseProducer closeProducer) |
protected void |
handleConnect(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect connect) |
protected void |
handleConsumerStats(org.apache.pulsar.common.api.proto.PulsarApi.CommandConsumerStats commandConsumerStats) |
protected void |
handleEndTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxn command) |
protected void |
handleEndTxnOnPartition(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxnOnPartition command) |
protected void |
handleEndTxnOnSubscription(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxnOnSubscription command) |
protected void |
handleFlow(org.apache.pulsar.common.api.proto.PulsarApi.CommandFlow flow) |
protected void |
handleGetLastMessageId(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetLastMessageId getLastMessageId) |
protected void |
handleGetOrCreateSchema(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetOrCreateSchema commandGetOrCreateSchema) |
protected void |
handleGetSchema(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetSchema commandGetSchema) |
protected void |
handleGetTopicsOfNamespace(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetTopicsOfNamespace commandGetTopicsOfNamespace) |
protected void |
handleLookup(org.apache.pulsar.common.api.proto.PulsarApi.CommandLookupTopic lookup) |
protected void |
handleNewTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandNewTxn command) |
protected void |
handlePartitionMetadataRequest(org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata partitionMetadata) |
protected void |
handleProducer(org.apache.pulsar.common.api.proto.PulsarApi.CommandProducer cmdProducer) |
protected void |
handleRedeliverUnacknowledged(org.apache.pulsar.common.api.proto.PulsarApi.CommandRedeliverUnacknowledgedMessages redeliver) |
protected void |
handleSeek(org.apache.pulsar.common.api.proto.PulsarApi.CommandSeek seek) |
protected void |
handleSend(org.apache.pulsar.common.api.proto.PulsarApi.CommandSend send,
io.netty.buffer.ByteBuf headersAndPayload) |
protected void |
handleSubscribe(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe subscribe) |
protected void |
handleUnsubscribe(org.apache.pulsar.common.api.proto.PulsarApi.CommandUnsubscribe unsubscribe) |
boolean |
hasHAProxyMessage() |
protected void |
interceptCommand(org.apache.pulsar.common.api.proto.PulsarApi.BaseCommand command) |
boolean |
isActive() |
boolean |
isBatchMessageCompatibleVersion() |
protected boolean |
isHandshakeCompleted() |
boolean |
isPreciseDispatcherFlowControl() |
boolean |
isWritable() |
org.apache.pulsar.common.protocol.ByteBufPair |
newMessageAndIntercept(long consumerId,
org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData messageId,
int redeliveryCount,
io.netty.buffer.ByteBuf metadataAndPayload,
long[] ackSet,
String topic) |
io.netty.util.concurrent.Promise<Void> |
newPromise() |
void |
refreshAuthenticationCredentials() |
void |
removedConsumer(Consumer consumer) |
void |
removedProducer(Producer producer) |
void |
startSendOperation(Producer producer,
int msgSize,
int numMessages) |
cancelKeepAliveTask, getRemoteEndpointProtocolVersion, handlePing, handlePong, messageReceivedchannelRead, handleAckResponse, handleActiveConsumerChange, handleAddPartitionToTxnResponse, handleAddSubscriptionToTxnResponse, handleAuthChallenge, handleConnected, handleConsumerStatsResponse, handleEndTxnOnPartitionResponse, handleEndTxnOnSubscriptionResponse, handleEndTxnResponse, handleError, handleGetLastMessageIdSuccess, handleGetOrCreateSchemaResponse, handleGetSchemaResponse, handleGetTopicsOfNamespaceSuccess, handleLookupResponse, handleMessage, handleNewTxnResponse, handlePartitionResponse, handleProducerSuccess, handleReachedEndOfTopic, handleSendError, handleSendReceipt, handleSuccesschannelReadComplete, channelRegistered, channelUnregistered, userEventTriggeredensureNotSharable, handlerAdded, handlerRemoved, isSharablepublic ServerCnx(PulsarService pulsar)
public void channelActive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelActive in interface io.netty.channel.ChannelInboundHandlerchannelActive in class org.apache.pulsar.common.protocol.PulsarHandlerExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class org.apache.pulsar.common.protocol.PulsarHandlerExceptionpublic void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandlerchannelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught in interface io.netty.channel.ChannelHandlerexceptionCaught in interface io.netty.channel.ChannelInboundHandlerexceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapterExceptionprotected void handleLookup(org.apache.pulsar.common.api.proto.PulsarApi.CommandLookupTopic lookup)
handleLookup in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handlePartitionMetadataRequest(org.apache.pulsar.common.api.proto.PulsarApi.CommandPartitionedTopicMetadata partitionMetadata)
handlePartitionMetadataRequest in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleConsumerStats(org.apache.pulsar.common.api.proto.PulsarApi.CommandConsumerStats commandConsumerStats)
handleConsumerStats in class org.apache.pulsar.common.protocol.PulsarDecoderpublic void refreshAuthenticationCredentials()
protected void handleConnect(org.apache.pulsar.common.api.proto.PulsarApi.CommandConnect connect)
handleConnect in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleAuthResponse(org.apache.pulsar.common.api.proto.PulsarApi.CommandAuthResponse authResponse)
handleAuthResponse in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleSubscribe(org.apache.pulsar.common.api.proto.PulsarApi.CommandSubscribe subscribe)
handleSubscribe in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleProducer(org.apache.pulsar.common.api.proto.PulsarApi.CommandProducer cmdProducer)
handleProducer in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleSend(org.apache.pulsar.common.api.proto.PulsarApi.CommandSend send,
io.netty.buffer.ByteBuf headersAndPayload)
handleSend in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleAck(org.apache.pulsar.common.api.proto.PulsarApi.CommandAck ack)
handleAck in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleFlow(org.apache.pulsar.common.api.proto.PulsarApi.CommandFlow flow)
handleFlow in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleRedeliverUnacknowledged(org.apache.pulsar.common.api.proto.PulsarApi.CommandRedeliverUnacknowledgedMessages redeliver)
handleRedeliverUnacknowledged in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleUnsubscribe(org.apache.pulsar.common.api.proto.PulsarApi.CommandUnsubscribe unsubscribe)
handleUnsubscribe in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleSeek(org.apache.pulsar.common.api.proto.PulsarApi.CommandSeek seek)
handleSeek in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleCloseProducer(org.apache.pulsar.common.api.proto.PulsarApi.CommandCloseProducer closeProducer)
handleCloseProducer in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleCloseConsumer(org.apache.pulsar.common.api.proto.PulsarApi.CommandCloseConsumer closeConsumer)
handleCloseConsumer in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleGetLastMessageId(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetLastMessageId getLastMessageId)
handleGetLastMessageId in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleGetTopicsOfNamespace(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetTopicsOfNamespace commandGetTopicsOfNamespace)
handleGetTopicsOfNamespace in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleGetSchema(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetSchema commandGetSchema)
handleGetSchema in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleGetOrCreateSchema(org.apache.pulsar.common.api.proto.PulsarApi.CommandGetOrCreateSchema commandGetOrCreateSchema)
handleGetOrCreateSchema in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleNewTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandNewTxn command)
handleNewTxn in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleAddPartitionToTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandAddPartitionToTxn command)
handleAddPartitionToTxn in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleEndTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxn command)
handleEndTxn in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleEndTxnOnPartition(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxnOnPartition command)
handleEndTxnOnPartition in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleEndTxnOnSubscription(org.apache.pulsar.common.api.proto.PulsarApi.CommandEndTxnOnSubscription command)
handleEndTxnOnSubscription in class org.apache.pulsar.common.protocol.PulsarDecoderprotected void handleAddSubscriptionToTxn(org.apache.pulsar.common.api.proto.PulsarApi.CommandAddSubscriptionToTxn command)
handleAddSubscriptionToTxn in class org.apache.pulsar.common.protocol.PulsarDecoderprotected boolean isHandshakeCompleted()
isHandshakeCompleted in class org.apache.pulsar.common.protocol.PulsarHandlerpublic io.netty.channel.ChannelHandlerContext ctx()
protected void interceptCommand(org.apache.pulsar.common.api.proto.PulsarApi.BaseCommand command)
throws org.apache.pulsar.common.intercept.InterceptException
interceptCommand in class org.apache.pulsar.common.protocol.PulsarDecoderorg.apache.pulsar.common.intercept.InterceptExceptionpublic void closeProducer(Producer producer)
closeProducer in interface TransportCnxpublic void closeConsumer(Consumer consumer)
closeConsumer in interface TransportCnxprotected void close()
channelInactive() which clears all producers and
consumers from connection-mappublic SocketAddress clientAddress()
clientAddress in interface TransportCnxpublic void removedConsumer(Consumer consumer)
removedConsumer in interface TransportCnxpublic void removedProducer(Producer producer)
removedProducer in interface TransportCnxpublic boolean isActive()
isActive in interface TransportCnxpublic boolean isWritable()
isWritable in interface TransportCnxpublic void startSendOperation(Producer producer, int msgSize, int numMessages)
public void completedSendOperation(boolean isNonPersistentTopic,
int msgSize)
completedSendOperation in interface TransportCnxpublic void enableCnxAutoRead()
enableCnxAutoRead in interface TransportCnxpublic void disableCnxAutoRead()
disableCnxAutoRead in interface TransportCnxpublic void cancelPublishRateLimiting()
cancelPublishRateLimiting in interface TransportCnxpublic void cancelPublishBufferLimiting()
cancelPublishBufferLimiting in interface TransportCnxpublic org.apache.pulsar.common.protocol.ByteBufPair newMessageAndIntercept(long consumerId,
org.apache.pulsar.common.api.proto.PulsarApi.MessageIdData messageId,
int redeliveryCount,
io.netty.buffer.ByteBuf metadataAndPayload,
long[] ackSet,
String topic)
public org.apache.pulsar.broker.service.ServerCnx.State getState()
public SocketAddress getRemoteAddress()
public BrokerService getBrokerService()
getBrokerService in interface TransportCnxpublic String getRole()
public io.netty.util.concurrent.Promise<Void> newPromise()
newPromise in interface TransportCnxpublic io.netty.handler.codec.haproxy.HAProxyMessage getHAProxyMessage()
getHAProxyMessage in interface TransportCnxpublic boolean hasHAProxyMessage()
hasHAProxyMessage in interface TransportCnxpublic boolean isBatchMessageCompatibleVersion()
isBatchMessageCompatibleVersion in interface TransportCnxpublic String getClientVersion()
getClientVersion in interface TransportCnxpublic long getMessagePublishBufferSize()
getMessagePublishBufferSize in interface TransportCnxpublic boolean isPreciseDispatcherFlowControl()
isPreciseDispatcherFlowControl in interface TransportCnxpublic AuthenticationState getAuthState()
public AuthenticationDataSource getAuthenticationData()
getAuthenticationData in interface TransportCnxpublic String getPrincipal()
public AuthenticationProvider getAuthenticationProvider()
public String getAuthRole()
TransportCnxgetAuthRole in interface TransportCnxpublic String getAuthMethod()
public org.apache.pulsar.common.util.collections.ConcurrentLongHashMap<CompletableFuture<Consumer>> getConsumers()
public org.apache.pulsar.common.util.collections.ConcurrentLongHashMap<CompletableFuture<Producer>> getProducers()
public PulsarCommandSender getCommandSender()
getCommandSender in interface TransportCnxpublic void execute(Runnable runnable)
execute in interface TransportCnxCopyright © 2017–2021 Apache Software Foundation. All rights reserved.