@Twitter 25
Now let’s say you need to
authenticate requests
Slide 26
Slide 26 text
@Twitter 26
type Service[Req, Rep] = Req => Future[Rep]
!
type Filter[Req, Rep] =
(Req, Service[Req, Rep]) => Future[Rep]
Slide 27
Slide 27 text
@Twitter 27
type Service[Req, Rep] = Req => Future[Rep]
!
type Filter[Req, Rep] =
(Req, Service[Req, Rep]) => Future[Rep]
Filter Filter Server
Client
Slide 28
Slide 28 text
@Twitter 28
def isAuthed(req: Req): Boolean
val authFilter: Filter[HttpReq, HttpRes] = {
(req, svc) =>
if (isAuthed(req)) svc(req)
else Future.exception(new AccessDenied)
}
!
val authedServer: Service[HttpReq, HttpRes] =
authFilter andThen server
Slide 29
Slide 29 text
@Twitter 29
val instrumentedServer = authFilter
andThen traceRequest
andThen recordStats
andThen server
Slide 30
Slide 30 text
@Twitter 30
What are we working on now?
Slide 31
Slide 31 text
@Twitter 31
Service discovery
See the “Names” page on the Finagle user guide:
http://twitter.github.io/finagle/guide/Names.html
!
val client = Http.newService(
“zk!myzkhost.mycompany.com:2181!/my/zk/path”
)
Slide 32
Slide 32 text
@Twitter 32
Load balancing
Slide 33
Slide 33 text
@Twitter 33
Request multiplexing
See the “Protocols” page on the Finagle user guide:
http://twitter.github.io/finagle/guide/Protocols.html