Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package twitter

    Start with com.twitter.finagle.

    Definition Classes
    com
  • package finagle

    Finagle is an extensible RPC system.

    Finagle is an extensible RPC system.

    Services are represented by class com.twitter.finagle.Service. Clients make use of com.twitter.finagle.Service objects while servers implement them.

    Finagle contains a number of protocol implementations; each of these implement Client and/or com.twitter.finagle.Server. For example, Finagle's HTTP implementation, com.twitter.finagle.Http (in package finagle-http), exposes both.

    Thus a simple HTTP server is built like this:

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Await, Future}
    
    val service = new Service[Request, Response] {
      def apply(req: Request): Future[Response] =
        Future.value(Response())
    }
    val server = Http.server.serve(":8080", service)
    Await.ready(server)

    We first define a service to which requests are dispatched. In this case, the service returns immediately with a HTTP 200 OK response, and with no content.

    This service is then served via the Http protocol on TCP port 8080. Finally we wait for the server to stop serving.

    We can now query our web server:

    % curl -D - localhost:8080
    HTTP/1.1 200 OK

    Building an HTTP client is also simple. (Note that type annotations are added for illustration.)

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Future, Return, Throw}
    
    val client: Service[Request, Response] = Http.client.newService("localhost:8080")
    val f: Future[Response] = client(Request()).respond {
      case Return(rep) =>
        printf("Got HTTP response %s\n", rep)
      case Throw(exc) =>
        printf("Got error %s\n", exc)
    }

    Http.client.newService("localhost:8080") constructs a new com.twitter.finagle.Service instance connected to localhost TCP port 8080. We then issue a HTTP/1.1 GET request to URI "/". The service returns a com.twitter.util.Future representing the result of the operation. We listen to this future, printing an appropriate message when the response arrives.

    The Finagle homepage contains useful documentation and resources for using Finagle.

    Definition Classes
    twitter
  • object Thrift extends Client[ThriftClientRequest, Array[Byte]] with Server[Array[Byte], Array[Byte]]

    Client and server for Apache Thrift.

    Client and server for Apache Thrift. Thrift implements Thrift framed transport and binary protocol by default, though custom protocol factories (i.e. wire encoding) may be injected with withProtocolFactory. The client, Client[ThriftClientRequest, Array[Byte]] provides direct access to the thrift transport, but we recommend using code generation through either Scrooge or a fork of the Apache generator. A rich API is provided to support interfaces generated with either of these code generators.

    The client and server uses the standard thrift protocols, with support for both framed and buffered transports. Finagle attempts to upgrade the protocol in order to ship an extra envelope carrying additional request metadata, containing, among other things, request IDs for Finagle's RPC tracing facilities.

    The negotiation is simple: on connection establishment, an improbably-named method is dispatched on the server. If that method isn't found, we are dealing with a legacy thrift server, and the standard protocol is used. If the remote server is also a finagle server (or any other supporting this extension), we reply to the request, and every subsequent request is dispatched with an envelope carrying trace metadata. The envelope itself is also a Thrift struct described here.

    Clients

    Clients can be created directly from an interface generated from a Thrift IDL:

    For example, this IDL:

    service TestService {
      string query(1: string x)
    }

    compiled with Scrooge, generates the interface TestService.FutureIface. This is then passed into Thrift.Client.newIface:

    Thrift.client.newIface[TestService.FutureIface](
      addr, classOf[TestService.FutureIface])

    However note that the Scala compiler can insert the latter Class for us, for which another variant of newIface is provided:

    Thrift.client.newIface[TestService.FutureIface](addr)

    In Java, we need to provide the class object:

    TestService.FutureIface client =
      Thrift.client.newIface(addr, TestService.FutureIface.class);

    The client uses the standard thrift protocols, with support for both framed and buffered transports. Finagle attempts to upgrade the protocol in order to ship an extra envelope carrying trace IDs and client IDs associated with the request. These are used by Finagle's tracing facilities and may be collected via aggregators like Zipkin.

    The negotiation is simple: on connection establishment, an improbably-named method is dispatched on the server. If that method isn't found, we are dealing with a legacy thrift server, and the standard protocol is used. If the remote server is also a finagle server (or any other supporting this extension), we reply to the request, and every subsequent request is dispatched with an envelope carrying trace metadata. The envelope itself is also a Thrift struct described here.

    Servers

    TestService.FutureIface must be implemented and passed into serveIface:

    // An echo service
    ThriftMux.server.serveIface(":*", new TestService.FutureIface {
      def query(x: String): Future[String] = Future.value(x)
    })
    Definition Classes
    finagle
  • Client
  • Server
  • param

case class Client(stack: Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]] = Client.stack, params: Params = Client.params) extends StdStackClient[ThriftClientRequest, Array[Byte], Client] with WithSessionPool[Client] with WithDefaultLoadBalancer[Client] with ThriftRichClient with Product with Serializable

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Client
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. ThriftRichClient
  7. WithDefaultLoadBalancer
  8. WithSessionPool
  9. StdStackClient
  10. EndpointerStackClient
  11. WithSessionQualifier
  12. WithClientSession
  13. WithClientTransport
  14. WithClientAdmissionControl
  15. ClientParams
  16. CommonParams
  17. StackClient
  18. StackBasedClient
  19. Transformable
  20. Parameterized
  21. Client
  22. AnyRef
  23. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Client(stack: Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]] = Client.stack, params: Params = Client.params)

Type Members

  1. type Context = TransportContext

    The type of the transport's context.

    The type of the transport's context.

    Attributes
    protected
    Definition Classes
    ClientStdStackClient
  2. type In = ThriftClientRequest

    The type we write into the transport.

    The type we write into the transport.

    Attributes
    protected
    Definition Classes
    ClientStdStackClient
  3. type Out = Array[Byte]

    The type we read out of the transport.

    The type we read out of the transport.

    Attributes
    protected
    Definition Classes
    ClientStdStackClient
  4. class MultiplexedThriftClient extends AnyRef
    Definition Classes
    ThriftRichClient

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def build[ThriftService](name: Name, label: String, cls: Class[_], clientParam: RichClientParam, service: Service[ThriftClientRequest, Array[Byte]]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  6. def build[ThriftService](name: Name, label: String, cls: Class[_]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  7. def build[ThriftService](dest: Name, label: String)(implicit arg0: ClassTag[ThriftService]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  8. def build[ThriftService](dest: String, label: String)(implicit arg0: ClassTag[ThriftService]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  9. def build[ThriftService](dest: String)(implicit arg0: ClassTag[ThriftService]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  10. def build[ThriftService](dest: String, label: String, cls: Class[_]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  11. def build[ThriftService](dest: String, cls: Class[_]): ThriftService

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
  12. def clientId: Option[ClientId]
  13. val clientParam: RichClientParam
    Attributes
    protected
    Definition Classes
    ClientThriftRichClient
  14. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  15. def configured[P](psp: (P, Param[P])): Client

    Creates a new StackClient with parameter psp._1 and Stack Param type psp._2.

    Creates a new StackClient with parameter psp._1 and Stack Param type psp._2.

    Definition Classes
    ClientEndpointerStackClientStackClientParameterized
  16. def configured[P](p: P)(implicit arg0: Param[P]): Client

    Creates a new StackClient with parameter p.

    Creates a new StackClient with parameter p.

    Definition Classes
    EndpointerStackClientStackClientParameterized
  17. def configuredParams(newParams: Params): Client

    Creates a new StackClient with additional parameters newParams.

    Creates a new StackClient with additional parameters newParams.

    Definition Classes
    EndpointerStackClientStackClientParameterized
  18. def copy1(stack: Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]] = this.stack, params: Params = this.params): Client

    A copy constructor in lieu of defining StackClient as a case class.

    A copy constructor in lieu of defining StackClient as a case class.

    Attributes
    protected
    Definition Classes
    ClientStdStackClientEndpointerStackClient
  19. lazy val defaultClientName: String

    The client name used when group isn't named.

    The client name used when group isn't named.

    Attributes
    protected
    Definition Classes
    ClientThriftRichClient
  20. final def endpointer: Stackable[ServiceFactory[ThriftClientRequest, Array[Byte]]]

    A stackable module that creates new Transports (via transporter) when applied.

    A stackable module that creates new Transports (via transporter) when applied.

    Attributes
    protected
    Definition Classes
    StdStackClientEndpointerStackClient
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def filtered(filter: Filter[ThriftClientRequest, Array[Byte], ThriftClientRequest, Array[Byte]]): Client

    Prepends filter to the top of the client.

    Prepends filter to the top of the client. That is, after materializing the client (newClient/newService) filter will be the first element which requests flow through. This is a familiar chaining combinator for filters and is particularly useful for StdStackClient implementations that don't expose services but instead wrap the resulting service with a rich API.

    Definition Classes
    ClientEndpointerStackClient
  23. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  26. def methodPerEndpoint[ServicePerEndpoint, MethodPerEndpoint](servicePerEndpoint: ServicePerEndpoint)(implicit builder: MethodPerEndpointBuilder[ServicePerEndpoint, MethodPerEndpoint]): MethodPerEndpoint

    Converts from a Service interface (ServicePerEndpoint) to the method interface (MethodPerEndpoint).

    Converts from a Service interface (ServicePerEndpoint) to the method interface (MethodPerEndpoint).

    Definition Classes
    ThriftRichClient
  27. def multiplex[T](dest: String, label: String)(build: (MultiplexedThriftClient) ⇒ T): T

    Build client interfaces for multiplexed thrift serivces.

    Build client interfaces for multiplexed thrift serivces.

    E.g.

    val client = Thrift.client.multiplex(address, "client") { client =>
      new {
        val echo = client.newIface[Echo.FutureIface]("echo")
        val extendedEcho = client.newServiceIface[ExtendedEcho.ServiceIface]("extendedEcho")
      }
    }
    
    client.echo.echo("hello")
    client.extendedEcho.getStatus(ExtendedEcho.GetStatus.Args())
    Definition Classes
    ThriftRichClient
  28. def multiplex[T](dest: Name, label: String)(build: (MultiplexedThriftClient) ⇒ T): T

    Build client interfaces for multiplexed thrift serivces.

    Build client interfaces for multiplexed thrift serivces.

    E.g.

    val client = Thrift.client.multiplex(address, "client") { client =>
      new {
        val echo = client.newIface[Echo.FutureIface]("echo")
        val extendedEcho = client.newServiceIface[ExtendedEcho.ServiceIface]("extendedEcho")
      }
    }
    
    client.echo.echo("hello")
    client.extendedEcho.getStatus(ExtendedEcho.GetStatus.Args())
    Definition Classes
    ThriftRichClient
  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. def newClient(dest: Name, label: String): ServiceFactory[ThriftClientRequest, Array[Byte]]

    Create a new client connected to dest.

    Create a new client connected to dest. See the user guide for details on destination names.

    Argument label is used to assign a label to this client. The label is used to display stats, etc.

    Definition Classes
    ClientEndpointerStackClientClient
  31. final def newClient(dest: String, label: String): ServiceFactory[ThriftClientRequest, Array[Byte]]

    Create a new client connected to dest.

    Create a new client connected to dest. See the user guide for details on destination names.

    Argument label is used to assign a label to this client. The label is used to display stats, etc.

    Definition Classes
    Client
  32. final def newClient(dest: String): ServiceFactory[ThriftClientRequest, Array[Byte]]

    Create a new client connected to dest.

    Create a new client connected to dest. See the user guide for details on destination names.

    Definition Classes
    Client
  33. def newDispatcher(transport: Transport[ThriftClientRequest, Array[Byte]] { type Context <: Client.this.Context }): Service[ThriftClientRequest, Array[Byte]]

    Defines a dispatcher, a function which reconciles the stream based Transport with a Request/Response oriented Service.

    Defines a dispatcher, a function which reconciles the stream based Transport with a Request/Response oriented Service. Together with a Transporter, it forms the foundation of a finagle client. Concrete implementations are expected to specify this.

    Attributes
    protected
    Definition Classes
    ClientStdStackClient
    See also

    com.twitter.finagle.dispatch.GenSerialServerDispatcher

  34. def newService(dest: Name, label: String): Service[ThriftClientRequest, Array[Byte]]

    Create a new service which dispatches requests to dest.

    Create a new service which dispatches requests to dest. See the user guide for details on destination names.

    Argument label is used to assign a label to this client. The label is used to display stats, etc.

    Definition Classes
    EndpointerStackClientClient
  35. final def newService(dest: String, label: String): Service[ThriftClientRequest, Array[Byte]]

    Create a new service which dispatches requests to dest.

    Create a new service which dispatches requests to dest. See the user guide for details on destination names.

    Definition Classes
    Client
  36. final def newService(dest: String): Service[ThriftClientRequest, Array[Byte]]

    Create a new service which dispatches requests to dest.

    Create a new service which dispatches requests to dest. See the user guide for details on destination names.

    Definition Classes
    Client
  37. def newTransporter(addr: SocketAddress): Transporter[In, Out, Context]

    Defines a typed com.twitter.finagle.client.Transporter for this client.

    Defines a typed com.twitter.finagle.client.Transporter for this client. Concrete StackClient implementations are expected to specify this.

    Attributes
    protected
    Definition Classes
    ClientStdStackClient
  38. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  39. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. val params: Params
    Definition Classes
    ClientThriftRichClientStackClientParameterized
  41. final def registerTransporter(transporterName: String): Unit

    Export info about the transporter type so that we can query info about its implementation at runtime.

    Export info about the transporter type so that we can query info about its implementation at runtime.

    Attributes
    protected
    Definition Classes
    StackClient
  42. def reqRepMethodPerEndpoint[ReqRepServicePerEndpoint, MethodPerEndpoint](servicePerEndpoint: ReqRepServicePerEndpoint)(implicit builder: ReqRepMethodPerEndpointBuilder[ReqRepServicePerEndpoint, MethodPerEndpoint]): MethodPerEndpoint

    Converts from a Scrooge Request/Response Service interface (ReqRepServicePerEndpoint) to the method interface (MethodPerEndpoint).

    Converts from a Scrooge Request/Response Service interface (ReqRepServicePerEndpoint) to the method interface (MethodPerEndpoint).

    Definition Classes
    ThriftRichClient
  43. def reqRepServicePerEndpoint[ReqRepServicePerEndpoint <: Filterable[ReqRepServicePerEndpoint]](service: Service[ThriftClientRequest, Array[Byte]], label: String)(implicit builder: ReqRepServicePerEndpointBuilder[ReqRepServicePerEndpoint]): ReqRepServicePerEndpoint

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method that uses the Scrooge Request/Response envelopes:

    val loggerService: Logger.ReqRepServicePerEndpoint = Thrift.client.reqRepServicePerEndpoint[Logger.ReqRepServicePerEndpoint]("localhost:8000", "client_label")
    val response: c.t.scrooge.Response[String] = loggerService.log(c.t.scrooge.Request(Logger.Log.Args("log message", 1)))

    This allows you to access any contained c.t.scrooge.Request and c.t.scrooge.Response headers.

    service

    The Finagle Thrift Service to be used.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  44. def reqRepServicePerEndpoint[ReqRepServicePerEndpoint <: Filterable[ReqRepServicePerEndpoint]](dest: Name, label: String)(implicit builder: ReqRepServicePerEndpointBuilder[ReqRepServicePerEndpoint]): ReqRepServicePerEndpoint

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method that uses the Scrooge Request/Response envelopes:

    val loggerService: Logger.ReqRepServicePerEndpoint = Thrift.client.reqRepServicePerEndpoint[Logger.ReqRepServicePerEndpoint]("localhost:8000", "client_label")
    val response: c.t.scrooge.Response[String] = loggerService.log(c.t.scrooge.Request(Logger.Log.Args("log message", 1)))

    This allows you to access any contained c.t.scrooge.Request and c.t.scrooge.Response headers.

    dest

    Address of the service to connect to.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  45. def reqRepServicePerEndpoint[ReqRepServicePerEndpoint <: Filterable[ReqRepServicePerEndpoint]](dest: String, label: String)(implicit builder: ReqRepServicePerEndpointBuilder[ReqRepServicePerEndpoint]): ReqRepServicePerEndpoint

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    Construct a Finagle Service[scrooge.Request, scrooge.Response] per-endpoint (method) for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method that uses the Scrooge Request/Response envelopes:

    val loggerService: Logger.ReqRepServicePerEndpoint = Thrift.client.reqRepServicePerEndpoint[Logger.ReqRepServicePerEndpoint]("localhost:8000", "client_label")
    val response: c.t.scrooge.Response[String] = loggerService.log(c.t.scrooge.Request(Logger.Log.Args("log message", 1)))

    This allows you to access any contained c.t.scrooge.Request and c.t.scrooge.Response headers.

    dest

    Address of the service to connect to, in the format accepted by Resolver.eval.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  46. def servicePerEndpoint[ServicePerEndpoint <: Filterable[ServicePerEndpoint]](service: Service[ThriftClientRequest, Array[Byte]], label: String)(implicit builder: ServicePerEndpointBuilder[ServicePerEndpoint]): ServicePerEndpoint

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServicePerEndpoint = Thrift.client.servicePerEndpoint[Logger.ServicePerEndpoint]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    service

    The Finagle Service to be used.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  47. def servicePerEndpoint[ServicePerEndpoint <: Filterable[ServicePerEndpoint]](dest: Name, label: String)(implicit builder: ServicePerEndpointBuilder[ServicePerEndpoint]): ServicePerEndpoint

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServicePerEndpoint = Thrift.client.servicePerEndpoint[Logger.ServicePerEndpoint]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    dest

    Address of the service to connect to.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  48. def servicePerEndpoint[ServicePerEndpoint <: Filterable[ServicePerEndpoint]](dest: String, label: String)(implicit builder: ServicePerEndpointBuilder[ServicePerEndpoint]): ServicePerEndpoint

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServicePerEndpoint = Thrift.client.servicePerEndpoint[Logger.ServicePerEndpoint]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    dest

    Address of the service to connect to, in the format accepted by Resolver.eval.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
  49. val stack: Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]]
    Definition Classes
    ClientStackClient
  50. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  51. def transformed(f: (Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]]) ⇒ Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]]): Client

    Creates a new StackClient with f applied to stack.

    Creates a new StackClient with f applied to stack.

    For expert users only.

    Definition Classes
    EndpointerStackClient
  52. def transformed(t: Transformer): StackClient[ThriftClientRequest, Array[Byte]]

    Transform the stack using the given Transformer.

    Transform the stack using the given Transformer.

    Definition Classes
    StackClientTransformable
  53. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  56. val withAdmissionControl: ClientAdmissionControlParams[Client]
    Definition Classes
    ClientWithClientAdmissionControl
  57. def withAttemptTTwitterUpgrade: Client
  58. def withBufferedTransport: Client

    Use a buffered transport instead of the default framed transport.

    Use a buffered transport instead of the default framed transport. In almost all cases, the default framed transport should be used.

  59. def withClientId(clientId: ClientId): Client
  60. def withExceptionStatsHandler(exceptionStatsHandler: ExceptionStatsHandler): Client

    Configures this server or client with given exception stats handler.

    Configures this server or client with given exception stats handler.

    Definition Classes
    ClientCommonParams
  61. def withLabel(label: String): Client

    Configures this server or client with given label (default: empty string).

    Configures this server or client with given label (default: empty string).

    The label value is used for stats reporting to scope stats reported from different clients/servers to a single stats receiver.

    Definition Classes
    ClientCommonParams
  62. val withLoadBalancer: DefaultLoadBalancingParams[Client]
    Definition Classes
    ClientWithDefaultLoadBalancer
  63. def withMaxReusableBufferSize(size: Int): Client

    Produce a com.twitter.finagle.Thrift.Client with the specified max size of the reusable buffer for thrift responses.

    Produce a com.twitter.finagle.Thrift.Client with the specified max size of the reusable buffer for thrift responses. If this size is exceeded, the buffer is not reused and a new buffer is allocated for the next thrift response. The default max size is 16Kb.

    size

    Max size of the reusable buffer for thrift responses in bytes.

  64. def withMonitor(monitor: Monitor): Client

    Configures this server or client with given util.Monitor (default: com.twitter.finagle.util.DefaultMonitor).

    Configures this server or client with given util.Monitor (default: com.twitter.finagle.util.DefaultMonitor).

    Definition Classes
    ClientCommonParams
  65. def withNoAttemptTTwitterUpgrade: Client
  66. def withParams(params: Params): Client

    Creates a new StackClient with params used to configure this StackClient's stack.

    Creates a new StackClient with params used to configure this StackClient's stack.

    Definition Classes
    EndpointerStackClientStackClientParameterized
  67. def withProtocolFactory(protocolFactory: TProtocolFactory): Client
  68. def withRequestTimeout(timeout: Duration): Client

    Configures the request timeout of this server or client (default: unbounded).

    Configures the request timeout of this server or client (default: unbounded).

    If the request has not completed within the given timeout, the pending work will be interrupted via com.twitter.util.Future.raise.

    Client's Request Timeout

    The client request timeout is the maximum amount of time given to a single request (if there are retries, they each get a fresh request timeout). The timeout is applied only after a connection has been acquired. That is: it is applied to the interval between the dispatch of the request and the receipt of the response.

    Server's Request Timeout

    The server request timeout is the maximum amount of time, a server is allowed to spend handling the incoming request. Using the Finagle terminology, this is an amount of time after which a non-satisfied future returned from the user-defined service times out.

    Definition Classes
    ClientCommonParams
    See also

    https://twitter.github.io/finagle/guide/Clients.html#timeouts-expiration

  69. def withRequestTimeout(timeout: Tunable[Duration]): Client

    Configures the Tunable request timeout of this server or client (if applying the Tunable produces a value of None, an unbounded timeout is used for the request).

    Configures the Tunable request timeout of this server or client (if applying the Tunable produces a value of None, an unbounded timeout is used for the request).

    If the request has not completed within the Duration resulting from timeout.apply(), the pending work will be interrupted via com.twitter.util.Future.raise.

    Client's Request Timeout

    The client request timeout is the maximum amount of time given to a single request (if there are retries, they each get a fresh request timeout). The timeout is applied only after a connection has been acquired. That is: it is applied to the interval between the dispatch of the request and the receipt of the response.

    Server's Request Timeout

    The server request timeout is the maximum amount of time, a server is allowed to spend handling the incoming request. Using the Finagle terminology, this is an amount of time after which a non-satisfied future returned from the user-defined service times out.

    Definition Classes
    CommonParams
    See also

    https://twitter.github.io/finagle/guide/Clients.html#timeouts-expiration and https://twitter.github.io/finagle/guide/Configuration.html#tunables

  70. def withResponseClassifier(responseClassifier: ResponseClassifier): Client

    Configure a com.twitter.finagle.service.ResponseClassifier which is used to determine the result of a request/response.

    Configure a com.twitter.finagle.service.ResponseClassifier which is used to determine the result of a request/response.

    This allows developers to give Finagle the additional application-specific knowledge necessary in order to properly classify responses. Without this, Finagle cannot make judgements about application-level failures as it only has a narrow understanding of failures (for example: transport level, timeouts, and nacks).

    As an example take an HTTP server that returns a response with a 500 status code. To Finagle this is a successful request/response. However, the application developer may want to treat all 500 status codes as failures and can do so via setting a com.twitter.finagle.service.ResponseClassifier.

    ResponseClassifier is a PartialFunction and as such multiple classifiers can be composed together via PartialFunction.orElse.

    Response classification is independently configured on the client and server. For client-side response classification using com.twitter.finagle.builder.ClientBuilder, see com.twitter.finagle.builder.ClientBuilder.responseClassifier

    Definition Classes
    ClientCommonParams
    Note

    If unspecified, the default classifier is com.twitter.finagle.service.ResponseClassifier.Default which is a total function fully covering the input domain.

    See also

    com.twitter.finagle.http.service.HttpResponseClassifier for some HTTP classification tools.

  71. def withRetryBackoff(backoff: Stream[Duration]): Client

    Configures the requeue backoff policy of this client (default: no delay).

    Configures the requeue backoff policy of this client (default: no delay).

    The backoff policy is represented by a stream of delays (i.e., Stream[Duration]) used to delay each retry.

    Definition Classes
    ClientClientParams
    See also

    https://twitter.github.io/finagle/guide/Clients.html#retries

  72. def withRetryBudget(budget: RetryBudget): Client

    Configures the retry budget of this client (default: allows for about 20% of the total requests to be retried on top of 10 retries per second).

    Configures the retry budget of this client (default: allows for about 20% of the total requests to be retried on top of 10 retries per second).

    This budget is shared across requests and governs the number of retries that can be made by this client.

    Definition Classes
    ClientClientParams
    Note

    The retry budget helps prevent clients from overwhelming the downstream service.

    See also

    https://twitter.github.io/finagle/guide/Clients.html#retries

  73. val withSession: ClientSessionParams[Client]
    Definition Classes
    ClientWithClientSession
  74. val withSessionPool: SessionPoolingParams[Client]
    Definition Classes
    ClientWithSessionPool
  75. val withSessionQualifier: SessionQualificationParams[Client]
    Definition Classes
    ClientWithSessionQualifier
  76. def withStack(stack: Stack[ServiceFactory[ThriftClientRequest, Array[Byte]]]): Client

    A new StackClient with the provided stack.

    A new StackClient with the provided stack.

    Definition Classes
    ClientEndpointerStackClientStackClient
  77. def withStatsReceiver(statsReceiver: StatsReceiver): Client

    Configures this server or client with given stats.StatsReceiver (default: stats.DefaultStatsReceiver).

    Configures this server or client with given stats.StatsReceiver (default: stats.DefaultStatsReceiver).

    Definition Classes
    ClientCommonParams
  78. def withTracer(tracer: Tracer): Client

    Configures this server or client with given tracing.Tracer (default: com.twitter.finagle.tracing.DefaultTracer).

    Configures this server or client with given tracing.Tracer (default: com.twitter.finagle.tracing.DefaultTracer).

    Definition Classes
    ClientCommonParams
  79. val withTransport: ClientTransportParams[Client]
    Definition Classes
    ClientWithClientTransport

Deprecated Value Members

  1. def newIface[Iface](name: Name, label: String, cls: Class[_], protocolFactory: TProtocolFactory, service: Service[ThriftClientRequest, Array[Byte]]): Iface
    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-8-16) Use com.twitter.finagle.thrift.RichClientParam

  2. def newIface[Iface](name: Name, label: String, cls: Class[_], clientParam: RichClientParam, service: Service[ThriftClientRequest, Array[Byte]]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  3. def newIface[Iface](name: Name, label: String, cls: Class[_]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  4. def newIface[Iface](dest: Name, label: String)(implicit arg0: ClassTag[Iface]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  5. def newIface[Iface](dest: String, label: String)(implicit arg0: ClassTag[Iface]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  6. def newIface[Iface](dest: String)(implicit arg0: ClassTag[Iface]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  7. def newIface[Iface](dest: String, label: String, cls: Class[_]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  8. def newIface[Iface](dest: String, cls: Class[_]): Iface

    Create a new client of type Iface, which must be generated by Scrooge.

    Create a new client of type Iface, which must be generated by Scrooge.

    For Scala generated code, the Class passed in should be either ServiceName$FutureIface or ServiceName[Future].

    For Java generated code, the Class passed in should be ServiceName$ServiceIface.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-20) Use com.twitter.finagle.ThriftRichClient#build

  9. def newMethodIface[ServiceIface, FutureIface](serviceIface: ServiceIface)(implicit builder: MethodIfaceBuilder[ServiceIface, FutureIface]): FutureIface

    Converts from a Service interface (ServiceIface) to the method interface (newIface).

    Converts from a Service interface (ServiceIface) to the method interface (newIface).

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.ThriftRichClient#methodPerEndpoint[ServicePerEndpoint, MethodPerEndpoint]

  10. def newServiceIface[ServiceIface <: Filterable[ServiceIface]](service: Service[ThriftClientRequest, Array[Byte]], label: String)(implicit builder: ServiceIfaceBuilder[ServiceIface]): ServiceIface

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServiceIface = Thrift.client.newServiceIface[Logger.ServiceIface]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    service

    The Finagle Service to be used.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.ThriftRichClient#servicePerEndpoint[ServicePerEndpoint]

  11. def newServiceIface[ServiceIface <: Filterable[ServiceIface]](dest: Name, label: String)(implicit builder: ServiceIfaceBuilder[ServiceIface]): ServiceIface

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServiceIface = Thrift.client.newServiceIface[Logger.ServiceIface]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    dest

    Address of the service to connect to.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.ThriftRichClient#servicePerEndpoint[ServicePerEndpoint]

  12. def newServiceIface[ServiceIface <: Filterable[ServiceIface]](dest: String, label: String)(implicit builder: ServiceIfaceBuilder[ServiceIface]): ServiceIface

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    Construct a Finagle Service interface for a Scrooge-generated Thrift object.

    E.g. given a Thrift service

    service Logger {
      string log(1: string message, 2: i32 logLevel);
      i32 getLogSize();
    }

    you can construct a client interface with a Finagle Service per Thrift method:

    val loggerService: Logger.ServiceIface = Thrift.client.newServiceIface[Logger.ServiceIface]("localhost:8000", "client_label")
    val response: String = loggerService.log(Logger.Log.Args("log message", 1))
    dest

    Address of the service to connect to, in the format accepted by Resolver.eval.

    label

    Assign a label for scoped stats.

    builder

    The builder type is generated by Scrooge for a thrift service.

    Definition Classes
    ThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-11-13) Use com.twitter.finagle.ThriftRichClient#servicePerEndpoint[ServicePerEndpoint]

  13. def protocolFactory: TProtocolFactory
    Attributes
    protected
    Definition Classes
    ClientThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-08-16) Use clientParam.protocolFactory

  14. def stats: StatsReceiver
    Attributes
    protected
    Definition Classes
    ClientThriftRichClient
    Annotations
    @deprecated
    Deprecated

    (Since version 2017-08-16) Use clientParam.clientStats

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from ThriftRichClient

Inherited from WithSessionPool[Client]

Inherited from WithSessionQualifier[Client]

Inherited from WithClientSession[Client]

Inherited from WithClientTransport[Client]

Inherited from ClientParams[Client]

Inherited from CommonParams[Client]

Inherited from Parameterized[Client]

Inherited from AnyRef

Inherited from Any

Ungrouped