Class BrokerRegistryImpl
java.lang.Object
org.apache.pulsar.broker.loadbalance.extensions.BrokerRegistryImpl
- All Implemented Interfaces:
AutoCloseable,BrokerRegistry
The broker registry impl, base on the LockManager.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(BiConsumer<String, org.apache.pulsar.metadata.api.NotificationType> listener) Add listener to listen the broker register change.voidclose()Close the broker registry.Get the map of brokerId->brokerLookupData.Async get available brokers.Get the current broker ID.booleanReturn the broker has been registered.booleanReturn the broker registry is started.protected static booleanisVerifiedNotification(org.apache.pulsar.metadata.api.Notification t) protected static StringlookupAsync(String broker) Get the broker lookup data.Register local broker to metadata store.voidstart()Start broker registry.voidUnregister the broker.
-
Constructor Details
-
BrokerRegistryImpl
-
-
Method Details
-
start
Description copied from interface:BrokerRegistryStart broker registry.- Specified by:
startin interfaceBrokerRegistry- Throws:
PulsarServerException
-
isStarted
public boolean isStarted()Description copied from interface:BrokerRegistryReturn the broker registry is started.- Specified by:
isStartedin interfaceBrokerRegistry
-
isRegistered
public boolean isRegistered()Description copied from interface:BrokerRegistryReturn the broker has been registered.- Specified by:
isRegisteredin interfaceBrokerRegistry
-
registerAsync
Description copied from interface:BrokerRegistryRegister local broker to metadata store.- Specified by:
registerAsyncin interfaceBrokerRegistry
-
unregister
public void unregister() throws org.apache.pulsar.metadata.api.MetadataStoreExceptionDescription copied from interface:BrokerRegistryUnregister the broker. Same asModularLoadManager.disableBroker()- Specified by:
unregisterin interfaceBrokerRegistry- Throws:
org.apache.pulsar.metadata.api.MetadataStoreException
-
getBrokerId
Description copied from interface:BrokerRegistryGet the current broker ID.- Specified by:
getBrokerIdin interfaceBrokerRegistry- Returns:
- The service url without the protocol prefix, 'http://'. e.g. broker-xyz:port
-
getAvailableBrokersAsync
Description copied from interface:BrokerRegistryAsync get available brokers.- Specified by:
getAvailableBrokersAsyncin interfaceBrokerRegistry- Returns:
- The brokers service url list.
-
lookupAsync
Description copied from interface:BrokerRegistryGet the broker lookup data.- Specified by:
lookupAsyncin interfaceBrokerRegistry- Parameters:
broker- The service url without the protocol prefix, 'http://'. e.g. broker-xyz:port
-
getAvailableBrokerLookupDataAsync
Description copied from interface:BrokerRegistryGet the map of brokerId->brokerLookupData.- Specified by:
getAvailableBrokerLookupDataAsyncin interfaceBrokerRegistry- Returns:
- Map of broker lookup data.
-
addListener
public void addListener(BiConsumer<String, org.apache.pulsar.metadata.api.NotificationType> listener) Description copied from interface:BrokerRegistryAdd listener to listen the broker register change.- Specified by:
addListenerin interfaceBrokerRegistry- Parameters:
listener- Key is broker IdBrokerRegistry.getBrokerId()Value is notification type.
-
close
Description copied from interface:BrokerRegistryClose the broker registry.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBrokerRegistry- Throws:
PulsarServerException- if it fails to close the broker registry.
-
isVerifiedNotification
protected static boolean isVerifiedNotification(org.apache.pulsar.metadata.api.Notification t) -
keyPath
-