trait Server[Req, Rep] extends AnyRef
Servers implement RPC servers with Req
-typed requests and
Rep
-typed responses. Servers dispatch requests to a
com.twitter.finagle.Service or
com.twitter.finagle.ServiceFactory provided through serve
.
Servers are implemented by the various protocol packages in finagle, for example com.twitter.finagle.Http:
object Http extends Server[HttpRequest, HttpResponse] ... val server = Http.serve(":*", new Service[HttpRequest, HttpResponse] { def apply(req: HttpRequest): Future[HttpResponse] = ... })
Will bind to an ephemeral port (":*") and dispatch request to
server.boundAddress
to the provided
com.twitter.finagle.Service instance.
The serve
method has two variants: one for instances of
Service
, and another for ServiceFactory
. The ServiceFactory
variants are used for protocols in which connection state is
significant: a new Service
is requested from the
ServiceFactory
for each new connection, and requests on that
connection are dispatched to the supplied service. The service is
also closed when the client disconnects or the connection is
otherwise terminated.
- Alphabetic
- By Inheritance
- Server
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def serve(addr: SocketAddress, service: ServiceFactory[Req, Rep]): ListeningServer
Serve
service
ataddr
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def serve(addr: String, service: Service[Req, Rep]): ListeningServer
Serve
service
ataddr
- final def serve(addr: String, service: ServiceFactory[Req, Rep]): ListeningServer
Serve
service
ataddr
- final def serve(addr: SocketAddress, service: Service[Req, Rep]): ListeningServer
Serve
service
ataddr
- def serveAndAnnounce(name: String, service: Service[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - def serveAndAnnounce(name: String, service: ServiceFactory[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - def serveAndAnnounce(name: String, addr: String, service: Service[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - def serveAndAnnounce(name: String, addr: String, service: ServiceFactory[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - def serveAndAnnounce(name: String, addr: SocketAddress, service: Service[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - def serveAndAnnounce(name: String, addr: SocketAddress, service: ServiceFactory[Req, Rep]): ListeningServer
Serve
service
ataddr
and announce withname
.Serve
service
ataddr
and announce withname
. Announcements will be removed when the service is closed. Omitting theaddr
will bind to an ephemeral port. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()