Used by Thrift and ThriftMux Client to facilitate giving the Finagle stack access to various data that are computed outside of Finagle's stack.
Used by Thrift and ThriftMux Client to facilitate giving the Finagle stack access to various data that are computed outside of Finagle's stack.
This includes:
While this is thread-safe, it should only be used for the life of a single request/response pair.
When using Scrooge for code
generation, a proper ClientDeserializeCtx
will be available
to code via Contexts.local(ClientDeserializeCtx.Key)
.
this class has evolved and it's name is now a bit too specific for its more expanded role.
A Filter
for Thrift services that enforces all
requests specify a com.twitter.finagle.thrift.ClientId
.
An abstract class that all scrooge-generated thrift service objects inherit directly from, including services that extend other services.
Indicates that the connection on which a Thrift request was issued is invalid, where "validity" is determined by com.twitter.finagle.thrift.ValidateThriftService.
Stores information about the current Thrift method.
Stores information about the current Thrift method. This information is set in both Java and Scala generated code. It is expected that users will only need to interact with com.twitter.finagle.thrift.MethodMetadata.current to obtain the current MethodMetadata if it has been set.
Indicates that a request without a com.twitter.finagle.thrift.ClientId
was issued to a server that requires them.
Indicates that a request without a com.twitter.finagle.thrift.ClientId
was issued to a server that requires them. See
com.twitter.finagle.thrift.ClientIdRequiredFilter for details.
Thrift-specific parameters for configuring clients.
Produce a server with params wrapped in RichServerParam
Produce a server with params wrapped in RichServerParam
A TProtocolFactory
creates protocol objects from transports
For server stats, (default: "thrift")
The max size of a reusable buffer for the thrift response
StatsReceiver for recording metrics
Whether to record per-endpoint stats, (default: false). By enabling this, the specific Thrift Exceptions can be recorded. See PerEndpoint StatsFilter
A Filter
that overrides Thrift request sequence IDs,
replacing them with our own randomly-assigned i32s.
A Filter
that overrides Thrift request sequence IDs,
replacing them with our own randomly-assigned i32s. Upon response receipt,
this filter ensures that responses have the correct corresponding sequence ID,
failing any requests that do not.
This only works when using BinaryProtocol.
Indicates that a Thrift response did not have the correct sequence ID according to that assigned by com.twitter.finagle.thrift.SeqIdFilter on the corresponding request.
Used by Thrift and ThriftMux Server to facilitate giving the Finagle stack access to the deserialized forms of Thrift requests and responses.
Used by Thrift and ThriftMux Server to facilitate giving the Finagle stack access to the deserialized forms of Thrift requests and responses.
While this is thread-safe, it should only be used for the life of a single request/response pair.
When using Scrooge for code
generation, a proper ServerToReqRep
will be available
to code via Contexts.local(ServerToReqRep.Key)
.
Stateless helper methods which wrap a given ServiceIface
(deprecated) or a
given ServicePerEndpoint
with another type via the given method's implicit Builder.
A mixin trait to provide a rich Thrift client API.
A mixin trait to provide a rich Thrift server API.
A marker trait that signifies that this is a thrift service that can be served by Finagle
A trait that signifies a ThriftService
can be created from this
A filter that invalidates a connection if it suffers from an irrecoverable application exception.
A filter that invalidates a connection if it suffers from an irrecoverable application exception.
Amazingly, an Apache Thrift server will leave a connection in a bad state without closing it, and furthermore only expose such errors as an "application" exception.
All we can do is sigh, pinch our noses, and apply
ValidateThriftService
.
(Since version 2018-8-13) Use ClientDeserializeCtx.
A typeclass to construct a MethodIface by wrapping a ServiceIface.
A typeclass to construct a MethodIface by wrapping a ServiceIface. This is a compatibility constructor to replace an existing Future interface with one built from a ServiceIface.
Scrooge generates implementations of this builder.
(Since version 2017-11-13) Use com.twitter.finagle.thrift.service.MethodPerEndpointBuilder
Typeclass ServiceIfaceBuilder[T] creates T-typed interfaces from thrift clients.
Typeclass ServiceIfaceBuilder[T] creates T-typed interfaces from thrift clients. Scrooge generates implementations of this builder.
(Since version 2017-11-13) Use com.twitter.finagle.thrift.service.ServicePerEndpointBuilder
A com.twitter.finagle.context.LocalContext Key for a stored com.twitter.finagle.thrift.MethodMetadata along with an accessor method for retrieving the currently set value.
(Since version 2018-8-13) Use ClientDeserializeCtx.
Deprecation
Please use the new interface, com.twitter.finagle.Thrift, for constructing Thrift clients and servers.
Thrift codecs
We provide client and server protocol support for the framed protocol. The public implementations are defined on the Thrift object:
The type of the server codec is
Service[Array[Byte], Array[Byte]]
and the client codecs areService[ThriftClientRequest, Array[Byte]]
. The service provided is that of a "transport" of thrift messages (requests and replies) according to the protocol chosen. This is why the client codecs need to have access to a thriftProtocolFactory
.These transports are used by the services produced by the finagle thrift codegenerator.
In this example,
Hello
is the thrift interface, and the inner classServiceToClient
is provided by the finagle thrift code generator.