@InterfaceAudience.LimitedPrivate @InterfaceStability.Evolving public interface ProtocolHandler extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(String protocol)
Verify if the protocol can speak the given protocol.
|
void |
close() |
String |
getProtocolDataToAdvertise()
Retrieve the protocol related data to advertise as part of
LocalBrokerData. |
void |
initialize(ServiceConfiguration conf)
Initialize the protocol handler when the protocol is constructed from reflection.
|
Map<InetSocketAddress,io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> |
newChannelInitializers()
Create the list of channel initializers for the ports that this protocol handler
will listen on.
|
String |
protocolName()
Returns the unique protocol name.
|
void |
start(BrokerService service)
Start the protocol handler with the provided broker service.
|
String protocolName()
boolean accept(String protocol)
protocol - the protocol to verifyvoid initialize(ServiceConfiguration conf) throws Exception
The initialize should initialize all the resources required for serving the protocol
handler but don't start those resources until start(BrokerService) is called.
conf - broker service configurationException - when fail to initialize the protocol handler.String getProtocolDataToAdvertise()
LocalBrokerData.
For example, when implementing a Kafka protocol handler, you need to advertise corresponding Kafka listeners so that Pulsar brokers understand how to give back the listener information when handling metadata requests.
NOTE: this method is called after initialize(ServiceConfiguration)
and before start(BrokerService).
void start(BrokerService service)
The broker service provides the accesses to the Pulsar components such as load manager, namespace service, managed ledger and etc.
service - the broker service to start with.Map<InetSocketAddress,io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>> newChannelInitializers()
NOTE: this method is called after start(BrokerService).
void close()
close in interface AutoCloseableCopyright © 2017–2022 Apache Software Foundation. All rights reserved.