finagle-clojure.builder.server
Functions for creating and altering com.twitter.finagle.Server
objects independent of any particular codec. Generally speaking codec-specific server functions should be preferred, but these are included for comptability with older systems configured at the server level.
bind-to
(bind-to b p)
Configures the given ServerBuilder with a port.
Arguments:
b
: a ServerBuilderp
: the port number to bind this server to
Returns:
a bound ServerBuilder
build
(build b svc)
Given a completed ServerBuilder
and a Service
, constructs an Server
which is capable of responding to requests.
Arguments:
b
: a ServerBuildersvc
: the Service this server will use to respond to requests
Returns:
a running instance of com.twitter.finagle.builder.Server
builder
(builder)
A handy Builder for constructing Servers (i.e., binding Services to a port). The ServerBuilder
requires the definition of codec
, bind-to
and named
.
The main class to use is com.twitter.finagle.builder.ServerBuilder, as so:
(-> (builder)
(named "servicename")
(bind-to 3000)
(build some-service))
Arguments:
- None.
Returns:
a new instance of com.twitter.finagle.builder.ServerBuilder.
close!
(close! server)
Stops the given Server.
Arguments:
server
: an instance of com.twitter.finagle.builder.Server
Returns:
a Future that closes when the server stops
codec
(codec b cdc)
Configures the given ServerBuilder with a codec.
Arguments:
b
: a ServerBuildercdc
: a Codec, CodecFactory, or Function1 that defines the server codec
Returns:
a ServerBuilder configured with the given codec
max-concurrent-requests
(max-concurrent-requests b mcr)
Configures the given ServerBuilder to accept a maximum number of concurrent requests.
Arguments:
b
: a ServerBuildermcr
: the maximum number of concurrent requests
Returns:
a ServerBuilder configured with a maximum number of concurrent requests
named
(named b name)
Configures the given ServerBuilder with a name.
Arguments:
b
: a ServerBuildername
: the name of this server
Returns:
a named ServerBuilder
report-to
(report-to b rcvr)
Configures the given ServerBuilder to report to a stats receiver.
Arguments:
b
: a ServerBuilderrcvr
: a StatsReceiver
Returns:
a ServerBuilder configured with the given stats receiver
request-timeout
(request-timeout b d)
Configures the given ServerBuilder with a request timeout.
Arguments:
b
: a ServerBuilderd
: the duration of the request timeout for this server
Returns:
a ServerBuilder configured with the given timeout
tracer
(tracer b tracer)
Configures the given ServerBuilder to use a Tracer.
Arguments:
b
: a ServerBuildertracer
: a Tracer
Returns:
a ServerBuilder configured with the given tracer