Class GrpcChannelProvider


  • public class GrpcChannelProvider
    extends Object

    Provides a gRPC Managed Channel object by use by Nitric Service Clients.

    The default host and port values are '127.0.0.1' and 50051 respectively. To change these default values set the respective Environment Variables: NITRIC_SERVICE_HOST and NITRIC_SERVICE_PORT.

    • Constructor Detail

      • GrpcChannelProvider

        public GrpcChannelProvider()
    • Method Detail

      • getChannel

        public static io.grpc.ManagedChannel getChannel()
        Returns:
        the Nitric gRPC Managed Channel.
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        the string representation of this object
      • getEnvVar

        protected static String getEnvVar​(String varName,
                                          String defaultValue)
        Return the environment variable value if defined or the default value otherwise.
        Parameters:
        varName - the environmental variable name (required)
        defaultValue - the default fallback value (required)
        Returns:
        the environment variable value or default if not defined