Class LHClientConfig

  • Direct Known Subclasses:
    LHWorkerConfig

    public class LHClientConfig
    extends io.littlehorse.sdk.common.config.ConfigBase
    This class is used to configure the LHClient class.
    • Constructor Summary

      Constructors 
      Constructor Description
      LHClientConfig()
      Creates an LHClientConfig.
      LHClientConfig​(java.lang.String propLocation)
      Creates an LHClientConfig with config props in a specified .properties file.
      LHClientConfig​(java.util.Map<java.lang.String,​java.lang.Object> configs)
      Creates an LHClientConfig with provided config values.
      LHClientConfig​(java.util.Properties props)
      Creates an LHClientConfig with provided config values.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Set<java.lang.String> configNames()
      Returns a set of all config names.
      java.lang.String getApiBootstrapHost()  
      int getApiBootstrapPort()  
      io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub()
      Gets an Async gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.
      io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub​(java.lang.String host, int port)
      Gets an Async gRPC stub for the LH Public API on a specified host and port.
      io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub()
      Gets a Blocking gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.
      io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub​(java.lang.String host, int port)
      Gets a Blocking gRPC stub for the LH Public API on a specified host and port.
      java.lang.String getClientId()  
      boolean isOauth()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • API_HOST_KEY

        public static final java.lang.String API_HOST_KEY
        The bootstrap host for the LH Server.
        See Also:
        Constant Field Values
      • API_PORT_KEY

        public static final java.lang.String API_PORT_KEY
        The bootstrap port for the LH Server.
        See Also:
        Constant Field Values
      • CLIENT_ID_KEY

        public static final java.lang.String CLIENT_ID_KEY
        The Client Id.
        See Also:
        Constant Field Values
      • CLIENT_CERT_KEY

        public static final java.lang.String CLIENT_CERT_KEY
        Optional location of Client Cert file.
        See Also:
        Constant Field Values
      • CLIENT_KEY_KEY

        public static final java.lang.String CLIENT_KEY_KEY
        Optional location of Client Private Key File.
        See Also:
        Constant Field Values
      • CA_CERT_KEY

        public static final java.lang.String CA_CERT_KEY
        Optional location of CA Cert File.
        See Also:
        Constant Field Values
      • OAUTH_CLIENT_ID_KEY

        public static final java.lang.String OAUTH_CLIENT_ID_KEY
        See Also:
        Constant Field Values
      • OAUTH_CLIENT_SECRET_KEY

        public static final java.lang.String OAUTH_CLIENT_SECRET_KEY
        See Also:
        Constant Field Values
      • OAUTH_AUTHORIZATION_SERVER_KEY

        public static final java.lang.String OAUTH_AUTHORIZATION_SERVER_KEY
        See Also:
        Constant Field Values
    • Constructor Detail

      • LHClientConfig

        public LHClientConfig()
        Creates an LHClientConfig. Loads default values for config from env vars.
      • LHClientConfig

        public LHClientConfig​(java.util.Properties props)
        Creates an LHClientConfig with provided config values.
        Parameters:
        props - configuration values.
      • LHClientConfig

        public LHClientConfig​(java.lang.String propLocation)
        Creates an LHClientConfig with config props in a specified .properties file.
        Parameters:
        propLocation - the location of the .properties file.
      • LHClientConfig

        public LHClientConfig​(java.util.Map<java.lang.String,​java.lang.Object> configs)
        Creates an LHClientConfig with provided config values.
        Parameters:
        configs - configuration values.
    • Method Detail

      • configNames

        public static java.util.Set<java.lang.String> configNames()
        Returns a set of all config names.
        Returns:
        A Set of all config names.
      • getBlockingStub

        public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub()
                                                                                                throws java.io.IOException
        Gets a Blocking gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.
        Returns:
        a blocking gRPC stub for the configured host/port.
        Throws:
        java.io.IOException - if stub creation fails.
      • getAsyncStub

        public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub()
                                                                                     throws java.io.IOException
        Gets an Async gRPC stub for the LH Public API on the configured host/port, which is generally the loadbalancer url.
        Returns:
        an async gRPC stub for the configured host/port.
        Throws:
        java.io.IOException - if stub creation fails.
      • getAsyncStub

        public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiStub getAsyncStub​(java.lang.String host,
                                                                                            int port)
                                                                                     throws java.io.IOException
        Gets an Async gRPC stub for the LH Public API on a specified host and port. Generally used by the Task Worker, which needs to connect directly to a specific LH Server rather than the bootstrap host (loadbalancer).
        Parameters:
        host - is the host that the LH Server lives on.
        port - is the port that the LH Server lives on.
        Returns:
        an async gRPC stub for that host/port combo.
        Throws:
        java.io.IOException - if stub creation fails.
      • getBlockingStub

        public io.littlehorse.sdk.common.proto.LHPublicApiGrpc.LHPublicApiBlockingStub getBlockingStub​(java.lang.String host,
                                                                                                       int port)
                                                                                                throws java.io.IOException
        Gets a Blocking gRPC stub for the LH Public API on a specified host and port. Generally used by the Task Worker, which needs to connect directly to a specific LH Server rather than the bootstrap host (loadbalancer).
        Parameters:
        host - is the host that the LH Server lives on.
        port - is the port that the LH Server lives on.
        Returns:
        a blocking gRPC stub for that host/port combo.
        Throws:
        java.io.IOException - if stub creation fails.
      • getApiBootstrapHost

        public java.lang.String getApiBootstrapHost()
      • getApiBootstrapPort

        public int getApiBootstrapPort()
      • getClientId

        public java.lang.String getClientId()
      • isOauth

        public boolean isOauth()