Interface THttpClient

  • All Superinterfaces:
    com.linecorp.armeria.client.ClientBuilderParams, com.linecorp.armeria.common.util.Unwrappable

    public interface THttpClient
    extends com.linecorp.armeria.common.util.Unwrappable, com.linecorp.armeria.client.ClientBuilderParams
    A generic Thrift-over-HTTP client.

    You will usually create a Thrift client object that implements a specific Thrift service interface (e.g. HelloService.AsyncIface):

    
     HelloService.AsyncIface client = Clients.newClient(
             "tbinary+http://127.0.0.1/hello", HelloService.AsyncIface.class);
     client.hello("John Doe", ...);
     
    However, if you want a generic Thrift client that works with any Thrift services, this client may be useful:
    
     ThriftClient client = Clients.newClient("tbinary+http://127.0.0.1/", ThriftClient.class);
     client.execute("/hello", HelloService.Iface.class, "hello", "John Doe");
     client.execute("/foo", FooService.Iface.class, "foo", "arg1", "arg2", ...);
     
    • Method Summary

      Modifier and Type Method Description
      com.linecorp.armeria.common.RpcResponse execute​(String path, Class<?> serviceType, String method, Object... args)
      Executes the specified Thrift call.
      com.linecorp.armeria.common.RpcResponse executeMultiplexed​(String path, Class<?> serviceType, String serviceName, String method, Object... args)
      Executes the specified multiplexed Thrift call.
      • Methods inherited from interface com.linecorp.armeria.client.ClientBuilderParams

        clientType, factory, options, uri
      • Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable

        as
    • Method Detail

      • execute

        com.linecorp.armeria.common.RpcResponse execute​(String path,
                                                        Class<?> serviceType,
                                                        String method,
                                                        Object... args)
        Executes the specified Thrift call.
        Parameters:
        path - the path of the Thrift service
        serviceType - the Thrift service interface
        method - the method name
        args - the arguments of the call
      • executeMultiplexed

        com.linecorp.armeria.common.RpcResponse executeMultiplexed​(String path,
                                                                   Class<?> serviceType,
                                                                   String serviceName,
                                                                   String method,
                                                                   Object... args)
        Executes the specified multiplexed Thrift call.
        Parameters:
        path - the path of the Thrift service
        serviceType - the Thrift service interface
        serviceName - the Thrift service name
        method - the method name
        args - the arguments of the call