Packages

o

com.twitter.finagle

ThriftMux

object ThriftMux extends Client[ThriftClientRequest, Array[Byte]] with Server[Array[Byte], Array[Byte]]

The ThriftMux object is both a com.twitter.finagle.Client and a com.twitter.finagle.Server for the Thrift protocol served over com.twitter.finagle.mux. Rich interfaces are provided to adhere to those generated from a Thrift IDL by Scrooge or thrift-finagle.

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 ThriftMux.Client.newIface:

ThriftMux.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:

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

In Java, we need to provide the class object:

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

Servers

Servers are also simple to expose:

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)
})

This object does not expose any configuration options. Both clients and servers are instantiated with sane defaults. Clients are labeled with the "clnt/thrift" prefix and servers with "srv/thrift". If you'd like more configuration, see the configuration documentation.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ThriftMux
  2. Server
  3. Client
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. case class Client (muxer: StackClient[Request, Response] = Client.muxer) extends StackBasedClient[ThriftClientRequest, Array[Byte]] with Parameterized[Client] with Transformable[Client] with CommonParams[Client] with ClientParams[Client] with WithClientTransport[Client] with WithClientAdmissionControl[Client] with WithClientSession[Client] with WithSessionQualifier[Client] with WithDefaultLoadBalancer[Client] with ThriftRichClient with Product with Serializable

    A ThriftMux com.twitter.finagle.Client.

    A ThriftMux com.twitter.finagle.Client.

    See also

    Mux documentation

    Thrift documentation

    Configuration documentation

  2. case class Server (muxer: StackServer[Request, Response] = serverMuxer) extends StackBasedServer[Array[Byte], Array[Byte]] with ThriftRichServer with Parameterized[Server] with CommonParams[Server] with WithServerTransport[Server] with WithServerSession[Server] with WithServerAdmissionControl[Server] with Product with Serializable

    A ThriftMux com.twitter.finagle.Server.

    A ThriftMux com.twitter.finagle.Server.

    See also

    Mux documentation

    Thrift documentation

    Configuration documentation

  3. case class ServerMuxer (stack: Stack[ServiceFactory[Request, Response]] = BaseServerStack, params: Params = ...) extends StdStackServer[Request, Response, ServerMuxer] with Product with Serializable

    A server for the Thrift protocol served over com.twitter.finagle.mux.

    A server for the Thrift protocol served over com.twitter.finagle.mux. ThriftMuxServer is backwards-compatible with Thrift clients that use the framed transport and binary protocol. It switches to the backward-compatible mode when the first request is not recognized as a valid Mux message but can be successfully handled by the underlying Thrift service. Since a Thrift message that is encoded with the binary protocol starts with a header value of 0x800100xx, Mux does not confuse it with a valid Mux message (0x80 = -128 is an invalid Mux message type) and the server can reliably detect the non-Mux Thrift client and switch to the backwards-compatible mode.

    Note that the server is also compatible with non-Mux finagle-thrift clients. It correctly responds to the protocol up-negotiation request and passes the tracing information embedded in the thrift requests to Mux (which has native tracing support).

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 client: Client
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  11. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. 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
    ThriftMuxClient
  15. 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
  16. 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
  17. 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
    ThriftMuxClient
  18. 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
  19. 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
  20. final def notify(): Unit
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  22. val protocolFactory: TProtocolFactory
    Attributes
    protected
  23. def serve(addr: SocketAddress, factory: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr

    Serve service at addr

    Definition Classes
    ThriftMuxServer
  24. def serve(addr: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr

    Serve service at addr

    Definition Classes
    Server
  25. def serve(addr: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr

    Serve service at addr

    Definition Classes
    Server
  26. def serve(addr: SocketAddress, service: Service[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr

    Serve service at addr

    Definition Classes
    Server
  27. def serveAndAnnounce(name: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  28. def serveAndAnnounce(name: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  29. def serveAndAnnounce(name: String, addr: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  30. def serveAndAnnounce(name: String, addr: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  31. def serveAndAnnounce(name: String, addr: SocketAddress, service: Service[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  32. def serveAndAnnounce(name: String, addr: SocketAddress, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer

    Serve service at addr and announce with name.

    Serve service at addr and announce with name. Announcements will be removed when the service is closed. Omitting the addr will bind to an ephemeral port.

    Definition Classes
    Server
  33. def server: Server
  34. val serverMuxer: ServerMuxer
  35. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  36. def toString(): String
    Definition Classes
    AnyRef → Any
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. object Client extends Serializable
  41. object Server extends Serializable

Inherited from finagle.Server[Array[Byte], Array[Byte]]

Inherited from AnyRef

Inherited from Any

Ungrouped