Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package twitter

    Start with com.twitter.finagle.

    Definition Classes
    com
  • package finagle

    Finagle is an extensible RPC system.

    Finagle is an extensible RPC system.

    Services are represented by class com.twitter.finagle.Service. Clients make use of com.twitter.finagle.Service objects while servers implement them.

    Finagle contains a number of protocol implementations; each of these implement Client and/or com.twitter.finagle.Server. For example, Finagle's HTTP implementation, com.twitter.finagle.Http (in package finagle-http), exposes both.

    Thus a simple HTTP server is built like this:

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Await, Future}
    
    val service = new Service[Request, Response] {
      def apply(req: Request): Future[Response] =
        Future.value(Response())
    }
    val server = Http.server.serve(":8080", service)
    Await.ready(server)

    We first define a service to which requests are dispatched. In this case, the service returns immediately with a HTTP 200 OK response, and with no content.

    This service is then served via the Http protocol on TCP port 8080. Finally we wait for the server to stop serving.

    We can now query our web server:

    % curl -D - localhost:8080
    HTTP/1.1 200 OK

    Building an HTTP client is also simple. (Note that type annotations are added for illustration.)

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Future, Return, Throw}
    
    val client: Service[Request, Response] = Http.client.newService("localhost:8080")
    val f: Future[Response] = client(Request()).respond {
      case Return(rep) =>
        printf("Got HTTP response %s\n", rep)
      case Throw(exc) =>
        printf("Got error %s\n", exc)
    }

    Http.client.newService("localhost:8080") constructs a new com.twitter.finagle.Service instance connected to localhost TCP port 8080. We then issue a HTTP/1.1 GET request to URI "/". The service returns a com.twitter.util.Future representing the result of the operation. We listen to this future, printing an appropriate message when the response arrives.

    The Finagle homepage contains useful documentation and resources for using Finagle.

    Definition Classes
    twitter
  • package netty3

    Package netty3 implements the bottom finagle primitives: {{com.twitter.finagle.Server}} and a client transport in terms of the netty3 event loop.

    Package netty3 implements the bottom finagle primitives: {{com.twitter.finagle.Server}} and a client transport in terms of the netty3 event loop.

    Note: when {{com.twitter.finagle.builder.ClientBuilder}} and {{com.twitter.finagle.builder.ServerBuilder}} are deprecated, package netty3 can move into its own package, so that only the (new-style) clients and servers that depend on netty3 bring it in.

    Definition Classes
    finagle
  • package channel
    Definition Classes
    netty3
  • BrokerChannelHandler
  • ChannelStatsHandler
  • IdleChannelHandler
  • LeftFoldUpstreamHandler
c

com.twitter.finagle.netty3.channel

BrokerChannelHandler

class BrokerChannelHandler extends SimpleChannelHandler

Linear Supertypes
SimpleChannelHandler, ChannelDownstreamHandler, ChannelUpstreamHandler, ChannelHandler, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BrokerChannelHandler
  2. SimpleChannelHandler
  3. ChannelDownstreamHandler
  4. ChannelUpstreamHandler
  5. ChannelHandler
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BrokerChannelHandler()

Type Members

  1. case class Bind(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  2. case class Bound(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  3. case class ChildClosed(e: ChildChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  4. case class ChildOpen(e: ChildChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  5. case class Close(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  6. case class Closed(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  7. case class Connect(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  8. case class Connected(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  9. case class Disconnect(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  10. case class Disconnected(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  11. sealed trait DownstreamEvent extends Event
  12. sealed trait Event extends AnyRef
  13. case class Exception(e: ExceptionEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  14. case class InterestChanged(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  15. case class InterestOps(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  16. case class Message(e: MessageEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  17. case class Open(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  18. case class Unbind(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  19. case class Unbound(e: ChannelStateEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable
  20. sealed trait UpstreamEvent extends Event
  21. case class Write(e: MessageEvent, ctx: ChannelHandlerContext) extends DownstreamEvent with Product with Serializable
  22. case class WriteComplete(e: WriteCompletionEvent, ctx: ChannelHandlerContext) extends UpstreamEvent with Product with Serializable

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def bindRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  6. def channelBound(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  7. def channelClosed(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  8. def channelConnected(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  9. def channelDisconnected(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  10. def channelInterestChanged(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  11. def channelOpen(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  12. def channelUnbound(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  13. def childChannelClosed(ctx: ChannelHandlerContext, e: ChildChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  14. def childChannelOpen(ctx: ChannelHandlerContext, e: ChildChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  16. def closeRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  17. def connectRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  18. def disconnectRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  19. val downstreamBroker: Broker[DownstreamEvent]
  20. val downstreamEvent: Offer[DownstreamEvent]
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  23. def exceptionCaught(ctx: ChannelHandlerContext, e: ExceptionEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  24. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  26. def handleDownstream(arg0: ChannelHandlerContext, arg1: ChannelEvent): Unit
    Definition Classes
    SimpleChannelHandler → ChannelDownstreamHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  27. def handleUpstream(arg0: ChannelHandlerContext, arg1: ChannelEvent): Unit
    Definition Classes
    SimpleChannelHandler → ChannelUpstreamHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. def messageReceived(ctx: ChannelHandlerContext, e: MessageEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  31. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  34. def proxy(): Unit

    Proxy both upstream & downstream events.

    Proxy both upstream & downstream events.

    Attributes
    protected
  35. def proxyDownstream(): Unit

    Proxy further downstream events.

    Proxy further downstream events.

    Attributes
    protected
  36. def proxyUpstream(): Unit

    Proxy further upstream events.

    Proxy further upstream events.

    Attributes
    protected
  37. def setInterestOpsRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  38. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  39. def toString(): String
    Definition Classes
    AnyRef → Any
  40. def unbindRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  41. val upstreamBroker: Broker[UpstreamEvent]
  42. val upstreamEvent: Offer[UpstreamEvent]
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  46. def writeComplete(ctx: ChannelHandlerContext, e: WriteCompletionEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  47. def writeRequested(ctx: ChannelHandlerContext, e: MessageEvent): Unit
    Definition Classes
    BrokerChannelHandler → SimpleChannelHandler
  48. object MessageValue
  49. object WriteValue

Inherited from SimpleChannelHandler

Inherited from ChannelDownstreamHandler

Inherited from ChannelUpstreamHandler

Inherited from ChannelHandler

Inherited from AnyRef

Inherited from Any

Ungrouped