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).
(Since version 6.7.x) Use destination names
(Since version 6.7.x) Use destination names via newIface(String) or newIface(Name)
(Since version 6.7.x) Use destination names via newIface(String) or newIface(Name)
(Since version 6.7.x) Use destination names
Produce a com.twitter.finagle.ThriftMux.Client using the provided client ID.
Produce a com.twitter.finagle.ThriftMux.Client using the provided client ID.
(Since version 6.22.0) Use ThriftMux.client.withClientId
Produce a com.twitter.finagle.ThriftMux.Client using the provided protocolFactory.
Produce a com.twitter.finagle.ThriftMux.Client using the provided protocolFactory.
(Since version 6.22.0) Use ThriftMux.client.withProtocolFactory
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 can be created directly from an interface generated from a Thrift IDL:
$clientExample
Servers are also simple to expose:
$serverExample
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 com.twitter.finagle.ThriftMux.Server and com.twitter.finagle.ThriftMux.Client classes.