I'm trying to write a finagle-thrift service that applies filters in the server.
finagle-thrift generates a service interface (Iface) from the thrift IDL that you implement and then pass to the Thrift.serveIface(addr, Iface)
method. There is another method Thrift.serve(addr, Service[Req, Rep])
which could be used to serve a slightly more generic service. Services can be composed, so I'd like to do something like Thrift.service(addr, myFilter andThen myService)
but I don't know how to convert an Iface to a Service.
The Thrift.serveIface
method uses a private method serverFromIface
which does the Iface to Service transformation that would allow me to compose the service with filters before passing it to Thrift.serve
. see: https://github.com/twitter/finagle/blob/master/finagle-thrift/src/main/scala/com/twitter/finagle/rich.scala
Since that transformation is private, I don't know how I am supposed to apply filters in the server.