Class ServiceConfigurationUtils


  • public class ServiceConfigurationUtils
    extends java.lang.Object
    • Constructor Detail

      • ServiceConfigurationUtils

        public ServiceConfigurationUtils()
    • Method Detail

      • getDefaultOrConfiguredAddress

        public static java.lang.String getDefaultOrConfiguredAddress​(java.lang.String configuredAddress)
      • unsafeLocalhostResolve

        public static java.lang.String unsafeLocalhostResolve()
      • getAppliedAdvertisedAddress

        @Deprecated
        public static java.lang.String getAppliedAdvertisedAddress​(ServiceConfiguration configuration,
                                                                   boolean ignoreAdvertisedListener)
        Deprecated.
        Get the address of Broker, first try to get it from AdvertisedAddress. If it is not set, try to get the address set by advertisedListener. If it is still not set, get it through InetAddress.getLocalHost().
        Parameters:
        configuration -
        ignoreAdvertisedListener - Sometimes we can’t use the default key of AdvertisedListener, setting it to true can ignore AdvertisedListener.
        Returns:
      • getInternalListener

        public static org.apache.pulsar.policies.data.loadbalancer.AdvertisedListener getInternalListener​(ServiceConfiguration config,
                                                                                                          java.lang.String protocol)
        Gets the internal advertised listener for broker-to-broker communication.
        Returns:
        a non-null advertised listener
      • getWebServiceAddress

        public static java.lang.String getWebServiceAddress​(ServiceConfiguration config)
        Gets the web service address (hostname).
      • brokerUrl

        public static java.lang.String brokerUrl​(java.lang.String host,
                                                 int port)
      • brokerUrlTls

        public static java.lang.String brokerUrlTls​(java.lang.String host,
                                                    int port)
      • webServiceUrl

        public static java.lang.String webServiceUrl​(java.lang.String host,
                                                     int port)
      • webServiceUrlTls

        public static java.lang.String webServiceUrlTls​(java.lang.String host,
                                                        int port)