Class LHConfig


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

      Constructors 
      Constructor Description
      LHConfig()
      Creates an LHClientConfig.
      LHConfig​(java.lang.String propLocation)
      Creates an LHClientConfig with config props in a specified .properties file.
      LHConfig​(java.util.Map<java.lang.String,​java.lang.Object> configs)
      Creates an LHClientConfig with provided config values.
      LHConfig​(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()  
      java.lang.String getApiProtocol()  
      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()  
      java.lang.String getConnectListener()
      Returns the name of the listener to connect to.
      long getKeepaliveTimeMs()  
      long getKeepaliveTimeoutMs()  
      io.littlehorse.sdk.common.proto.TaskDef getTaskDef​(java.lang.String taskDefName)
      Gets the `TaskDefPb` for a given taskDefName.
      java.lang.String getTaskWorkerVersion()
      Returns the TaskWorker Version of this worker.
      int getWorkerThreads()
      Returns the number of worker threads to run.
      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
      • API_PROTOCOL_KEY

        public static final java.lang.String API_PROTOCOL_KEY
        The bootstrap protocol 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_ACCESS_TOKEN_URL

        public static final java.lang.String OAUTH_ACCESS_TOKEN_URL
        See Also:
        Constant Field Values
      • NUM_WORKER_THREADS_KEY

        public static final java.lang.String NUM_WORKER_THREADS_KEY
        The number of worker threads to run.
        See Also:
        Constant Field Values
      • SERVER_CONNECT_LISTENER_KEY

        public static final java.lang.String SERVER_CONNECT_LISTENER_KEY
        Listener to connect to.
        See Also:
        Constant Field Values
      • GRPC_KEEPALIVE_TIME_MS_KEY

        public static final java.lang.String GRPC_KEEPALIVE_TIME_MS_KEY
        GRPC Connection Keepalive Interval
        See Also:
        Constant Field Values
      • GRPC_KEEPALIVE_TIMEOUT_MS_KEY

        public static final java.lang.String GRPC_KEEPALIVE_TIMEOUT_MS_KEY
        GRPC Connection Keepalive Interval
        See Also:
        Constant Field Values
      • TASK_WORKER_VERSION_KEY

        public static final java.lang.String TASK_WORKER_VERSION_KEY
        See Also:
        Constant Field Values
      • DEFAULT_PUBLIC_LISTENER

        public static final java.lang.String DEFAULT_PUBLIC_LISTENER
        See Also:
        Constant Field Values
      • DEFAULT_PROTOCOL

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

      • LHConfig

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

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

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

        public LHConfig​(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.
      • getTaskDef

        public io.littlehorse.sdk.common.proto.TaskDef getTaskDef​(java.lang.String taskDefName)
                                                           throws java.io.IOException
        Gets the `TaskDefPb` for a given taskDefName.
        Parameters:
        taskDefName - is the TaskDef's name.
        Returns:
        the specified TaskDefPb.
        Throws:
        java.io.IOException
      • getTaskWorkerVersion

        public java.lang.String getTaskWorkerVersion()
        Returns the TaskWorker Version of this worker.
        Returns:
        Task Worker Version.
      • getConnectListener

        public java.lang.String getConnectListener()
        Returns the name of the listener to connect to.
        Returns:
        the name of the listener on the LH Server to connect to.
      • 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.
      • getKeepaliveTimeMs

        public long getKeepaliveTimeMs()
      • getKeepaliveTimeoutMs

        public long getKeepaliveTimeoutMs()
      • getApiBootstrapHost

        public java.lang.String getApiBootstrapHost()
      • getApiBootstrapPort

        public int getApiBootstrapPort()
      • getApiProtocol

        public java.lang.String getApiProtocol()
      • getClientId

        public java.lang.String getClientId()
      • isOauth

        public boolean isOauth()
      • getWorkerThreads

        public int getWorkerThreads()
        Returns the number of worker threads to run.
        Returns:
        the number of worker threads to run.