Class BrokerVersionFilter

java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.BrokerVersionFilter
All Implemented Interfaces:
BrokerFilter

public class BrokerVersionFilter extends Object implements BrokerFilter
  • Constructor Details

    • BrokerVersionFilter

      public BrokerVersionFilter()
  • Method Details

    • getLatestVersionNumber

      public com.github.zafarkhaja.semver.Version getLatestVersionNumber(Set<String> brokers, LoadData loadData) throws BrokerFilterBadVersionException
      Get the most recent broker version number from the load reports of all the running brokers. The version number is from the build artifact in the pom and got added to the package when it was built by Maven
      Parameters:
      brokers - The brokers to choose the latest version string from.
      loadData - The load data from the leader broker (contains the load reports which in turn contain the version string).
      Returns:
      The most recent broker version
      Throws:
      BrokerFilterBadVersionException - If the most recent version is undefined (e.g., a bad broker version was encountered or a broker does not have a version string in its load report.
    • filter

      public void filter(Set<String> brokers, org.apache.pulsar.policies.data.loadbalancer.BundleData bundleToAssign, LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf) throws BrokerFilterBadVersionException
      From the given set of available broker candidates, filter those using the version numbers.
      Specified by:
      filter in interface BrokerFilter
      Parameters:
      brokers - The currently available brokers that have not already been filtered.
      bundleToAssign - The data for the bundle to assign.
      loadData - The load data from the leader broker.
      conf - The service configuration.
      Throws:
      BrokerFilterBadVersionException