Interface Brokers


public interface Brokers
Admin interface for brokers management.
  • Method Details

    • getActiveBrokers

      List<String> getActiveBrokers(String cluster) throws PulsarAdminException
      Get the list of active brokers in the cluster.

      Get the list of active brokers (web service addresses) 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 (host:port)
      Throws:
      PulsarAdminException.NotAuthorizedException - You don't have admin permission to get the list of active brokers in the cluster
      PulsarAdminException.NotFoundException - Cluster doesn't exist
      PulsarAdminException - Unexpected error
    • getActiveBrokersAsync

      CompletableFuture<List<String>> getActiveBrokersAsync(String cluster)
      Get the list of active brokers in the cluster asynchronously.

      Get the list of active brokers (web service addresses) 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 (host:port)
    • getLeaderBroker

      BrokerInfo getLeaderBroker() throws PulsarAdminException
      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

      CompletableFuture<BrokerInfo> getLeaderBrokerAsync() throws PulsarAdminException
      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 brokerUrl) 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 -
      brokerUrl -
      Returns:
      Throws:
      PulsarAdminException
    • getOwnedNamespacesAsync

      CompletableFuture<Map<String,NamespaceOwnershipStatus>> getOwnedNamespacesAsync(String cluster, String brokerUrl)
      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 -
      brokerUrl -
      Returns:
    • updateDynamicConfiguration

      void updateDynamicConfiguration(String configName, String configValue) throws PulsarAdminException
      Update a dynamic configuration value into ZooKeeper.

      It updates dynamic configuration value in to Zk that triggers watch on brokers and all brokers can update ServiceConfiguration value locally

      Parameters:
      configName -
      configValue -
      Throws:
      PulsarAdminException
    • updateDynamicConfigurationAsync

      CompletableFuture<Void> updateDynamicConfigurationAsync(String configName, String configValue)
      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 update ServiceConfiguration value locally

      Parameters:
      configName -
      configValue -
    • deleteDynamicConfiguration

      void deleteDynamicConfiguration(String configName) throws PulsarAdminException
      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

      CompletableFuture<Void> deleteDynamicConfigurationAsync(String configName)
      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

      List<String> getDynamicConfigurationNames() throws PulsarAdminException
      Get list of updatable configuration name.
      Returns:
      Throws:
      PulsarAdminException
    • getDynamicConfigurationNamesAsync

      CompletableFuture<List<String>> getDynamicConfigurationNamesAsync()
      Get list of updatable configuration name asynchronously.
      Returns:
    • getRuntimeConfigurations

      Map<String,String> getRuntimeConfigurations() throws PulsarAdminException
      Get values of runtime configuration.
      Returns:
      Throws:
      PulsarAdminException
    • getRuntimeConfigurationsAsync

      CompletableFuture<Map<String,String>> getRuntimeConfigurationsAsync()
      Get values of runtime configuration asynchronously.
      Returns:
    • getAllDynamicConfigurations

      Map<String,String> getAllDynamicConfigurations() throws PulsarAdminException
      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

      InternalConfigurationData getInternalConfigurationData() throws PulsarAdminException
      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

      void backlogQuotaCheck() throws PulsarAdminException
      Manually trigger backlogQuotaCheck.
      Throws:
      PulsarAdminException
    • backlogQuotaCheckAsync

      CompletableFuture<Void> backlogQuotaCheckAsync()
      Manually trigger backlogQuotaCheck asynchronously.
      Returns:
    • healthcheck

      @Deprecated void healthcheck() throws PulsarAdminException
      Deprecated.
      Run a healthcheck on the broker.
      Throws:
      PulsarAdminException - if the healthcheck fails.
    • healthcheckAsync

      @Deprecated CompletableFuture<Void> healthcheckAsync()
      Deprecated.
      Run a healthcheck on the broker asynchronously.
    • healthcheck

      void healthcheck(TopicVersion topicVersion) throws PulsarAdminException
      Run a healthcheck on the broker.
      Throws:
      PulsarAdminException - if the healthcheck fails.
    • healthcheckAsync

      CompletableFuture<Void> healthcheckAsync(TopicVersion topicVersion)
      Run a healthcheck on the broker asynchronously.
    • shutDownBrokerGracefully

      CompletableFuture<Void> shutDownBrokerGracefully(int maxConcurrentUnloadPerSec, boolean forcedTerminateTopic)
      Shutdown current broker gracefully.
      Parameters:
      maxConcurrentUnloadPerSec -
      forcedTerminateTopic -
      Returns:
    • getVersion

      String getVersion() throws PulsarAdminException
      Get version of broker.
      Returns:
      version of broker.
      Throws:
      PulsarAdminException