Package org.apache.pulsar.client.admin
Interface Brokers
public interface Brokers
Admin interface for brokers management.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Manually trigger backlogQuotaCheck.Manually trigger backlogQuotaCheck asynchronously.void
deleteDynamicConfiguration
(String configName) It deletes dynamic configuration value into ZooKeeper.deleteDynamicConfigurationAsync
(String configName) It deletes dynamic configuration value into ZooKeeper asynchronously.Get the list of active brokers in the local cluster.getActiveBrokers
(String cluster) Get the list of active brokers in the cluster.Get the list of active brokers in the local cluster asynchronously.getActiveBrokersAsync
(String cluster) Get the list of active brokers in the cluster asynchronously.Get values of all overridden dynamic-configs.Get values of all overridden dynamic-configs asynchronously.Get list of updatable configuration name.Get list of updatable configuration name asynchronously.Get the internal configuration data.Get the internal configuration data asynchronously.Get the information of the leader broker.Get the service url of the leader broker asynchronously.getOwnedNamespaces
(String cluster, String brokerId) Get the map of owned namespaces and their status from a single broker in the cluster.getOwnedNamespacesAsync
(String cluster, String brokerId) Get the map of owned namespaces and their status from a single broker in the cluster asynchronously.Get values of runtime configuration.Get values of runtime configuration asynchronously.Get version of broker.void
Deprecated.void
healthcheck
(TopicVersion topicVersion) Run a healthcheck on the broker.void
healthcheck
(TopicVersion topicVersion, Optional<String> brokerId) Run a healthcheck on the target broker or on the broker.Deprecated.healthcheckAsync
(TopicVersion topicVersion, Optional<String> brokerId) Run a healthcheck on the broker asynchronously.shutDownBrokerGracefully
(int maxConcurrentUnloadPerSec, boolean forcedTerminateTopic) Trigger the current broker to graceful-shutdown asynchronously.void
updateDynamicConfiguration
(String configName, String configValue) Update a dynamic configuration value into ZooKeeper.updateDynamicConfigurationAsync
(String configName, String configValue) Update a dynamic configuration value into ZooKeeper asynchronously.
-
Method Details
-
getActiveBrokers
Get the list of active brokers in the local cluster. Get the list of active brokers (broker ids) in the local cluster. Response Example:["prod1-broker1.messaging.use.example.com:8080", "prod1-broker2.messaging.use.example.com:8080" * * "prod1-broker3.messaging.use.example.com:8080"]
- Returns:
- a list of broker ids
- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to get the list of active brokers in the clusterPulsarAdminException
- Unexpected error
-
getActiveBrokersAsync
CompletableFuture<List<String>> getActiveBrokersAsync()Get the list of active brokers in the local cluster asynchronously. Get the list of active brokers (broker ids) in the local cluster. Response Example:["prod1-broker1.messaging.use.example.com:8080", "prod1-broker2.messaging.use.example.com:8080", "prod1-broker3.messaging.use.example.com:8080"]
- Returns:
- a list of broker ids
-
getActiveBrokers
Get the list of active brokers in the cluster. Get the list of active brokers (broker ids) in the cluster. Response Example:["prod1-broker1.messaging.use.example.com:8080", "prod1-broker2.messaging.use.example.com:8080" * * "prod1-broker3.messaging.use.example.com:8080"]
- Parameters:
cluster
- Cluster name- Returns:
- a list of broker ids
- Throws:
PulsarAdminException.NotAuthorizedException
- You don't have admin permission to get the list of active brokers in the clusterPulsarAdminException.NotFoundException
- Cluster doesn't existPulsarAdminException
- Unexpected error
-
getActiveBrokersAsync
Get the list of active brokers in the cluster asynchronously. Get the list of active brokers (broker ids) in the cluster. Response Example:["prod1-broker1.messaging.use.example.com:8080", "prod1-broker2.messaging.use.example.com:8080", "prod1-broker3.messaging.use.example.com:8080"]
- Parameters:
cluster
- Cluster name- Returns:
- a list of broker ids
-
getLeaderBroker
Get the information of the leader broker. Get the information of the leader broker. Response Example:{serviceUrl:"prod1-broker1.messaging.use.example.com:8080"}
- Returns:
- the information of the leader broker.
- Throws:
PulsarAdminException
- Unexpected error
-
getLeaderBrokerAsync
Get the service url of the leader broker asynchronously. Get the service url of the leader broker. Response Example:{serviceUrl:"prod1-broker1.messaging.use.example.com:8080"}
- Returns:
- the service url of the leader broker
- Throws:
PulsarAdminException
- Unexpected error
-
getOwnedNamespaces
Map<String,NamespaceOwnershipStatus> getOwnedNamespaces(String cluster, String brokerId) throws PulsarAdminException Get the map of owned namespaces and their status from a single broker in the cluster. The map is returned in a JSON object format below Response Example:{"ns-1":{"broker_assignment":"shared","is_active":"true","is_controlled":"false"}, "ns-2":{"broker_assignment":"primary","is_active":"true","is_controlled":"true"}}
- Parameters:
cluster
-brokerId
-- Returns:
- Throws:
PulsarAdminException
-
getOwnedNamespacesAsync
CompletableFuture<Map<String,NamespaceOwnershipStatus>> getOwnedNamespacesAsync(String cluster, String brokerId) Get the map of owned namespaces and their status from a single broker in the cluster asynchronously. The map is returned in a JSON object format below Response Example:{"ns-1":{"broker_assignment":"shared","is_active":"true","is_controlled":"false"}, "ns-2":{"broker_assignment":"primary","is_active":"true","is_controlled":"true"}}
- Parameters:
cluster
-brokerId
-- Returns:
-
updateDynamicConfiguration
Update a dynamic configuration value into ZooKeeper. It updates dynamic configuration value in to Zk that triggers watch on brokers and all brokers can updateinvalid reference
ServiceConfiguration
- Parameters:
configName
-configValue
-- Throws:
PulsarAdminException
-
updateDynamicConfigurationAsync
Update a dynamic configuration value into ZooKeeper asynchronously. It updates dynamic configuration value in to Zk that triggers watch on brokers and all brokers can updateinvalid reference
ServiceConfiguration
- Parameters:
configName
-configValue
-
-
deleteDynamicConfiguration
It deletes dynamic configuration value into ZooKeeper. It will not impact current value in broker but next time when broker restarts, it applies value from configuration file only.- Parameters:
configName
-- Throws:
PulsarAdminException
-
deleteDynamicConfigurationAsync
It deletes dynamic configuration value into ZooKeeper asynchronously. It will not impact current value in broker but next time when broker restarts, it applies value from configuration file only.- Parameters:
configName
-
-
getDynamicConfigurationNames
Get list of updatable configuration name.- Returns:
- Throws:
PulsarAdminException
-
getDynamicConfigurationNamesAsync
CompletableFuture<List<String>> getDynamicConfigurationNamesAsync()Get list of updatable configuration name asynchronously.- Returns:
-
getRuntimeConfigurations
Get values of runtime configuration.- Returns:
- Throws:
PulsarAdminException
-
getRuntimeConfigurationsAsync
CompletableFuture<Map<String,String>> getRuntimeConfigurationsAsync()Get values of runtime configuration asynchronously.- Returns:
-
getAllDynamicConfigurations
Get values of all overridden dynamic-configs.- Returns:
- Throws:
PulsarAdminException
-
getAllDynamicConfigurationsAsync
CompletableFuture<Map<String,String>> getAllDynamicConfigurationsAsync()Get values of all overridden dynamic-configs asynchronously.- Returns:
-
getInternalConfigurationData
Get the internal configuration data.- Returns:
- internal configuration data.
- Throws:
PulsarAdminException
-
getInternalConfigurationDataAsync
CompletableFuture<InternalConfigurationData> getInternalConfigurationDataAsync()Get the internal configuration data asynchronously.- Returns:
- internal configuration data.
-
backlogQuotaCheck
Manually trigger backlogQuotaCheck.- Throws:
PulsarAdminException
-
backlogQuotaCheckAsync
CompletableFuture<Void> backlogQuotaCheckAsync()Manually trigger backlogQuotaCheck asynchronously.- Returns:
-
healthcheck
Deprecated.Run a healthcheck on the broker.- Throws:
PulsarAdminException
- if the healthcheck fails.
-
healthcheckAsync
Deprecated.Run a healthcheck on the broker asynchronously. -
healthcheck
Run a healthcheck on the broker.- Throws:
PulsarAdminException
- if the healthcheck fails.
-
healthcheck
Run a healthcheck on the target broker or on the broker.- Parameters:
brokerId
- target broker id to check the health. If empty, it checks the health on the connected broker.- Throws:
PulsarAdminException
- if the healthcheck fails.
-
healthcheckAsync
Run a healthcheck on the broker asynchronously. -
shutDownBrokerGracefully
CompletableFuture<Void> shutDownBrokerGracefully(int maxConcurrentUnloadPerSec, boolean forcedTerminateTopic) Trigger the current broker to graceful-shutdown asynchronously.- Parameters:
maxConcurrentUnloadPerSec
- the maximum number of topics to unload per second. This helps control the speed of the unload operation during shutdown.forcedTerminateTopic
- if true, topics will be forcefully terminated during the shutdown process.
-
getVersion
Get version of broker.- Returns:
- version of broker.
- Throws:
PulsarAdminException
-