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.MethodPerEndpoint
. This is then passed
into ThriftMux.Client.build
:
ThriftMux.client.build[TestService.MethodPerEndpoint]( addr, classOf[TestService.MethodPerEndpoint])
However note that the Scala compiler can insert the latter
Class
for us, for which another variant of build
is
provided:
ThriftMux.client.build[TestService.MethodPerEndpoint](addr)
In Java, we need to provide the class object:
TestService.MethodPerEndpoint client =
ThriftMux.client.build(addr, TestService.MethodPerEndpoint.class);
Servers
Servers are also simple to expose:
TestService.MethodPerEndpoint
must be implemented and passed
into serveIface
:
// An echo service ThriftMux.server.serveIface(":*", new TestService.MethodPerEndpoint { 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.
- Alphabetic
- By Inheritance
- ThriftMux
- Server
- Client
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class Client(muxer: StackClient[Request, Response] = Client.standardMuxer) 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 WithThriftPartitioningStrategy[Client] with ThriftRichClient with OpportunisticTlsParams[Client] with WithCompressionPreferences[Client] with Product with Serializable
A ThriftMux
com.twitter.finagle.Client
.A ThriftMux
com.twitter.finagle.Client
.- See also
Configuration documentation
Thrift documentation
Mux documentation
- final case class Server(muxer: StackServer[Request, Response] = Server.defaultMuxer) extends StackBasedServer[Array[Byte], Array[Byte]] with ThriftRichServer with Parameterized[Server] with CommonParams[Server] with WithServerTransport[Server] with WithServerSession[Server] with WithServerAdmissionControl[Server] with OpportunisticTlsParams[Server] with WithCompressionPreferences[Server] with Product with Serializable
A ThriftMux
com.twitter.finagle.Server
.A ThriftMux
com.twitter.finagle.Server
.- See also
Configuration documentation
Thrift documentation
Mux documentation
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val BaseClientStack: Stack[ServiceFactory[Request, Response]]
Base com.twitter.finagle.Stack for ThriftMux clients.
- def BaseServerParams: Params
Base com.twitter.finagle.Stack.Params for ThriftMux servers.
- val BaseServerStack: Stack[ServiceFactory[Request, Response]]
Base com.twitter.finagle.Stack for ThriftMux servers.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def client: Client
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- 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. - 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
- 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
- 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. - 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
- 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
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val protocolFactory: TProtocolFactory
- Attributes
- protected
- def serve(addr: SocketAddress, factory: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
- final def serve(addr: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
Serve
service
ataddr
- Definition Classes
- Server
- final def serve(addr: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
Serve
service
ataddr
- Definition Classes
- Server
- final def serve(addr: SocketAddress, service: Service[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
Serve
service
ataddr
- Definition Classes
- Server
- def serveAndAnnounce(name: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def serveAndAnnounce(name: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def serveAndAnnounce(name: String, addr: String, service: Service[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def serveAndAnnounce(name: String, addr: String, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def serveAndAnnounce(name: String, addr: SocketAddress, service: Service[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def serveAndAnnounce(name: String, addr: SocketAddress, service: ServiceFactory[Array[Byte], Array[Byte]]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port.- Definition Classes
- Server
- def server: Server
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Client extends ThriftClient with Serializable
- object Server extends Serializable