Class GrpcClients

java.lang.Object
com.linecorp.armeria.client.grpc.GrpcClients

@UnstableApi public final class GrpcClients extends Object
Creates a new gRPC client that connects to a URI or an EndpointGroup.
  • Method Summary

    Modifier and Type
    Method
    Description
    builder(com.linecorp.armeria.common.Scheme scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
    Returns a new GrpcClientBuilder that builds the client that connects to the specified EndpointGroup with the specified Scheme.
    builder(com.linecorp.armeria.common.SessionProtocol protocol, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
    Returns a new GrpcClientBuilder that builds the gRPC client that connects to the specified EndpointGroup with the specified SessionProtocol and GrpcSerializationFormats.PROTO.
    Returns a new GrpcClientBuilder that builds the client that connects to the specified uri.
    builder(String scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
    Returns a new GrpcClientBuilder that builds the client that connects to the specified EndpointGroup with the specified scheme.
    builder(URI uri)
    Returns a new GrpcClientBuilder that builds the client that connects to the specified URI.
    static <T> T
    newClient(com.linecorp.armeria.common.Scheme scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
    Creates a new gRPC client that connects to the specified EndpointGroup with the specified Scheme using the default ClientFactory.
    static <T> T
    newClient(com.linecorp.armeria.common.SessionProtocol protocol, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
    Creates a new gRPC client that connects to the specified EndpointGroup with the specified SessionProtocol and GrpcSerializationFormats.PROTO using the default ClientFactory.
    static <T> T
    newClient(String scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
    Creates a new gRPC client that connects to the specified EndpointGroup with the specified scheme using the default ClientFactory.
    static <T> T
    newClient(String uri, Class<T> clientType)
    Creates a new gRPC client that connects to the specified uri using the default ClientFactory.
    static <T> T
    newClient(URI uri, Class<T> clientType)
    Creates a new gRPC client that connects to the specified URI using the default ClientFactory.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newClient

      public static <T> T newClient(String uri, Class<T> clientType)
      Creates a new gRPC client that connects to the specified uri using the default ClientFactory.

      Note that if a SerializationFormat is not specified in the Scheme component of the uri, GrpcSerializationFormats.PROTO will be used by default.

      Parameters:
      uri - the URI of the server endpoint
      clientType - the type of the new gRPC client
      Throws:
      IllegalArgumentException - if the specified uri is invalid, or the specified clientType is an unsupported gRPC client stub.
    • newClient

      public static <T> T newClient(URI uri, Class<T> clientType)
      Creates a new gRPC client that connects to the specified URI using the default ClientFactory.

      Note that if a SerializationFormat is not specified in the Scheme component of the URI, GrpcSerializationFormats.PROTO will be used by default.

      Parameters:
      uri - the URI of the server endpoint
      clientType - the type of the new gRPC client
      Throws:
      IllegalArgumentException - if the specified uri is invalid, or the specified clientType is an unsupported gRPC client stub.
    • newClient

      public static <T> T newClient(String scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
      Creates a new gRPC client that connects to the specified EndpointGroup with the specified scheme using the default ClientFactory.

      Note that if a SerializationFormat is not specified in the Scheme component of the URI, GrpcSerializationFormats.PROTO will be used by default.

      Parameters:
      scheme - the Scheme represented as a String
      endpointGroup - the server EndpointGroup
      clientType - the type of the new gRPC client
      Throws:
      IllegalArgumentException - if the specified scheme is invalid or the specified clientType is an unsupported gRPC client stub.
    • newClient

      public static <T> T newClient(com.linecorp.armeria.common.Scheme scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
      Creates a new gRPC client that connects to the specified EndpointGroup with the specified Scheme using the default ClientFactory.

      Note that if a SerializationFormat is not specified in the Scheme component of the URI, GrpcSerializationFormats.PROTO will be used by default.

      Parameters:
      scheme - the Scheme
      endpointGroup - the server EndpointGroup
      clientType - the type of the new gRPC client
      Throws:
      IllegalArgumentException - if the specified clientType is unsupported for the specified Scheme.
    • newClient

      public static <T> T newClient(com.linecorp.armeria.common.SessionProtocol protocol, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup, Class<T> clientType)
      Creates a new gRPC client that connects to the specified EndpointGroup with the specified SessionProtocol and GrpcSerializationFormats.PROTO using the default ClientFactory.
      Parameters:
      protocol - the SessionProtocol
      endpointGroup - the server EndpointGroup
      clientType - the type of the new gRPC client
      Throws:
      IllegalArgumentException - if the clientType is an unsupported gRPC client stub.
    • builder

      public static GrpcClientBuilder builder(String uri)
      Returns a new GrpcClientBuilder that builds the client that connects to the specified uri.

      Note that if a SerializationFormat is not specified in the Scheme component of the uri, GrpcSerializationFormats.PROTO will be used by default.

      Throws:
      IllegalArgumentException - if the specified uri is invalid, or the uri's scheme contains an invalid SerializationFormat.
    • builder

      public static GrpcClientBuilder builder(URI uri)
      Returns a new GrpcClientBuilder that builds the client that connects to the specified URI.

      Note that if a SerializationFormat is not specified in the Scheme component of the URI, GrpcSerializationFormats.PROTO will be used by default.

      Throws:
      IllegalArgumentException - if the specified URI is invalid, or the URI's scheme contains an invalid SerializationFormat.
    • builder

      public static GrpcClientBuilder builder(String scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
      Returns a new GrpcClientBuilder that builds the client that connects to the specified EndpointGroup with the specified scheme.

      Note that if a SerializationFormat is not specified in the given scheme, GrpcSerializationFormats.PROTO will be used by default.

      Throws:
      IllegalArgumentException - if the scheme is invalid.
    • builder

      public static GrpcClientBuilder builder(com.linecorp.armeria.common.SessionProtocol protocol, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
      Returns a new GrpcClientBuilder that builds the gRPC client that connects to the specified EndpointGroup with the specified SessionProtocol and GrpcSerializationFormats.PROTO.
    • builder

      public static GrpcClientBuilder builder(com.linecorp.armeria.common.Scheme scheme, com.linecorp.armeria.client.endpoint.EndpointGroup endpointGroup)
      Returns a new GrpcClientBuilder that builds the client that connects to the specified EndpointGroup with the specified Scheme.

      Note that if SerializationFormat.NONE is specified in the Scheme, GrpcSerializationFormats.PROTO will be used by default.