This is the method to override/implement to create your own Filter.
This is the method to override/implement to create your own Filter.
the input request type
a service that takes the output request type and the input response type
Convert the Filter.TypeAgnostic filter to a Filter and chain it with
andThen
.
Terminates a filter chain in a ServiceFactory.
Terminates a filter chain in a ServiceFactory. For example,
myFilter.andThen(myServiceFactory)
a service factory that takes the output request type and the input response type.
Terminates a filter chain in a Service.
Terminates a filter chain in a Service. For example,
myFilter.andThen(myService)
a service that takes the output request type and the input response type.
Chains a series of filters together:
Chains a series of filters together:
myModularService = handleExceptions.andThen(thrift2Pojo.andThen(parseString))
another filter to follow after this one
synchronously thrown exceptions in the underlying service are automatically lifted into Future.exception.
Conditionally propagates requests down the filter chain.
Conditionally propagates requests down the filter chain. This may useful if you are statically wiring together filter chains based on a configuration file, for instance.
a tuple of boolean and filter.
A Filter acts as a decorator/transformer of a service. It may apply transformations to the input and output of that service:
For example, you may have a service that takes
Strings
and parses them asInts
. If you want to expose this as a Network Service via Thrift, it is nice to isolate the protocol handling from the business rules. Hence you might have a Filter that converts back and forth between Thrift structs. Again, your service deals with plain objects:Thus, a
Filter[A, B, C, D]
converts aService[C, D]
to aService[A, B]
. In other words, it converts aService[ReqOut, RepIn]
to aService[ReqIn, RepOut]
.The user guide for details and examples.