Class CommonClientBuilder

java.lang.Object
io.continual.onap.services.mrCommon.CommonClientBuilder
Direct Known Subclasses:
OnapMsgRouterPublisher.Builder, OnapMsgRouterSubscriber.Builder

public class CommonClientBuilder extends Object
  • Constructor Details

    • CommonClientBuilder

      public CommonClientBuilder()
  • Method Details

    • withHost

      public CommonClientBuilder withHost(String host)
      Add a host to the set the publisher can use. If you do not provide a protocol, "http://" is assumed. You may specify "https://" or "http://". If you do not provide a port (e.g. "host:3904"), then 3904 is assumed for http, and 3905 for https. Thus "localhost" is treated as "http://localhost:3904".
      Parameters:
      host - the host to add to the host set
      Returns:
      this builder
    • withHosts

      public CommonClientBuilder withHosts(Collection<String> hosts)
      Add each host to the host list. See withHost ( String host ) for details.
      Parameters:
      hosts - a collection of hosts to add to the host set
      Returns:
      this builder
    • withHosts

      public CommonClientBuilder withHosts(String[] hosts)
      Add each host to the host list. See withHost ( String host ) for details.
      Parameters:
      hosts - a collection of hosts to add to the host set
      Returns:
      this builder
    • forgetHosts

      public CommonClientBuilder forgetHosts()
      Clear any hosts the builder already knows about.
      Returns:
      this builder
    • defaultHttp

      public CommonClientBuilder defaultHttp()
      If no protocol is provided on a host string, default to http://
      Returns:
      this builder
    • defaultHttps

      public CommonClientBuilder defaultHttps()
      If no protocol is provided on a host string, default to https://
      Returns:
      this builder
    • defaultHttps

      public CommonClientBuilder defaultHttps(boolean https)
      If no protocol is provided on a host string, default to https:// if true, http:// if false.
      Parameters:
      https - if true, use https. if false, use http
      Returns:
      this builder
    • usingProxy

      public CommonClientBuilder usingProxy(String proxy)
      Specify a proxy to use for the HTTP connection to Message Router.
      Parameters:
      proxy - a proxy string, which can optionally end in :port, e.g. proxy.example.com:8888
      Returns:
      this builder
    • usingProxy

      public CommonClientBuilder usingProxy(String host, int port)
      Specify a proxy to use for the HTTP connection to Message Router.
      Parameters:
      host - a proxy host name
      port - a port number
      Returns:
      this builder
    • onTopic

      public CommonClientBuilder onTopic(String topic)
      Specify the topic to publish to.
      Parameters:
      topic - the topic on which to post messages
      Returns:
      this builder
    • asUser

      public CommonClientBuilder asUser(String user, String pwd)
      Set HTTP basic auth credentials. If user is null, the auth info is removed from the builder.
      Parameters:
      user - the username for basic auth credentials
      pwd - the password for basic auth credentials
      Returns:
      this builder
    • withApiKey

      public CommonClientBuilder withApiKey(String apiKey, String apiSecret)
      Set an API key and secret. If the API key is null, the auth info is removed from the builder.
      Parameters:
      apiKey - the API key for the user
      apiSecret - the API key's secret
      Returns:
      this builder
    • waitingAtMost

      @Deprecated public CommonClientBuilder waitingAtMost(long ms)
      Deprecated.
      Use socketWaitAtMost
      Specify the amount of time to wait on a socket connection, read, or write.
      Parameters:
      ms - the number of milliseconds to wait for a socket operation (connect/read/write)
      Returns:
      this builder
    • socketWaitAtMost

      public CommonClientBuilder socketWaitAtMost(long ms)
      Specify the amount of time to wait on a socket connection, read, or write.
      Parameters:
      ms - the number of milliseconds to wait for a socket operation (connect/read/write)
      Returns:
      this builder
    • logTo

      public CommonClientBuilder logTo(org.slf4j.Logger log)
      Specify the log to use. If never called, the default logger, named for this class, is used.
      Parameters:
      log - the slf4j logger to use for this library. Do not pass null.
      Returns:
      this builder
    • withClock

      public CommonClientBuilder withClock(Clock clock)
      Specify a clock to use within this implementation.
      Parameters:
      clock - the clock to use for timing
      Returns:
      this builder
    • getHosts

      public List<String> getHosts()
    • getDefaultHttps

      public boolean getDefaultHttps()
    • isProxied

      public boolean isProxied()
    • getProxyHost

      public String getProxyHost()
    • getProxyPort

      public int getProxyPort()
    • getProxy

      public Proxy getProxy()
    • getTopic

      public String getTopic()
    • getSocketWaitMs

      public long getSocketWaitMs()
    • getLog

      public org.slf4j.Logger getLog()
    • getCredentials

      public HttpHelper.Credentials getCredentials()
    • getClock

      public Clock getClock()