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 builder
    Definition Classes
    finagle
  • ClientBuilder
  • ClientConfig
  • ClientConfigEvidence
  • IncompleteSpecification
  • SourceTrackingMonitor

class ClientBuilder[Req, Rep, HasCluster, HasCodec, HasHostConnectionLimit] extends AnyRef

A builder of Finagle Clients.

Please see the user guide for information on the preferred with-style and MethodBuilder client-construction APIs.

val client = ClientBuilder()
  .stack(Http.client)
  .hosts("localhost:10000,localhost:10001,localhost:10003")
  .hostConnectionLimit(1)
  .tcpConnectTimeout(1.second)        // max time to spend establishing a TCP connection.
  .retries(2)                         // (1) per-request retries
  .reportTo(DefaultStatsReceiver)     // export host-level load data to the loaded-StatsReceiver
  .build()

The ClientBuilder requires the definition of cluster, stack, and hostConnectionLimit. In Scala, these are statically type checked, and in Java the lack of any of the above causes a runtime error.

The build method uses an implicit argument to statically typecheck the builder (to ensure completeness, see above). The Java compiler cannot provide such implicit, so we provide a separate function in Java to accomplish this. Thus, the Java code for the above is

Service<HttpRequest, HttpResponse> service =
 ClientBuilder.safeBuild(
   ClientBuilder.get()
     .stack(Http.client())
     .hosts("localhost:10000,localhost:10001,localhost:10003")
     .hostConnectionLimit(1)
     .tcpConnectTimeout(1.second)
     .retries(2)
     .reportTo(DefaultStatsReceiver)

Alternatively, using the unsafeBuild method on ClientBuilder verifies the builder dynamically, resulting in a runtime error instead of a compiler error.

Defaults

The following defaults are applied to clients constructed via ClientBuilder, unless overridden with the corresponding method. These defaults were chosen carefully so as to work well for most use cases.

Commonly-configured options:

  • connectTimeout: Duration.Top
  • tcpConnectTimeout: 1 second
  • requestTimeout: Duration.Top
  • timeout: Duration.Top
  • hostConnectionLimit: Int.MaxValue
  • hostConnectionCoresize: 0
  • hostConnectionIdleTime: Duration.Top
  • hostConnectionMaxWaiters: Int.MaxValue
  • failFast: true
  • failureAccrualParams, failureAccrualFactory: numFailures = 5, markDeadFor = 5 seconds

Advanced options:

Before changing any of these, make sure that you know exactly how they will affect your application -- these options are typically only changed by expert users.

See also

The user guide for information on the preferred with-style and MethodBuilder client-construction APIs.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ClientBuilder
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type FullySpecifiedConfig = ClientConfig[Req, Rep, Yes, Yes, Yes]
  2. type This = ClientBuilder[Req, Rep, HasCluster, HasCodec, HasHostConnectionLimit]
  3. type ThisConfig = ClientConfig[Req, Rep, HasCluster, HasCodec, HasHostConnectionLimit]

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. def addrs(addrs: Address*): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    A convenience method for specifying a client with one or more com.twitter.finagle.Addresss.

    A convenience method for specifying a client with one or more com.twitter.finagle.Addresss.

    To migrate to the Stack-based APIs, use com.twitter.finagle.Client.newService(Name, String). For the label String, use the scope you want for your StatsReceiver. For example:

    import com.twitter.finagle.{Http, Name}
    
    val name: Name = Name.bound(addrs: _*)
    Http.client.newService(name, "the_client_name")
    Annotations
    @varargs()
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def baseDtab(baseDtab: () => Dtab): This

    The base com.twitter.finagle.Dtab used to interpret logical destinations for this client.

    The base com.twitter.finagle.Dtab used to interpret logical destinations for this client. (This is given as a function to permit late initialization of com.twitter.finagle.Dtab.base.)

    To migrate to the Stack-based APIs, use configured. For example:

    import com.twitter.finagle.Http
    import com.twitter.finagle.naming.BindingFactory
    
    Http.client.configured(BindingFactory.BaseDtab(baseDtab))
  7. def build()(implicit THE_BUILDER_IS_NOT_FULLY_SPECIFIED_SEE_ClientBuilder_DOCUMENTATION: ClientConfigEvidence[HasCluster, HasCodec, HasHostConnectionLimit]): Service[Req, Rep]

    Construct a Service.

    Construct a Service.

    To migrate to the Stack-based APIs, use Client.newService. For example:

    import com.twitter.finagle.Http
    
    Http.client.newService(destination)
  8. def buildFactory()(implicit THE_BUILDER_IS_NOT_FULLY_SPECIFIED_SEE_ClientBuilder_DOCUMENTATION: ClientConfigEvidence[HasCluster, HasCodec, HasHostConnectionLimit]): ServiceFactory[Req, Rep]

    Construct a ServiceFactory.

    Construct a ServiceFactory. This is useful for stateful protocols (e.g., those that support transactions or authentication).

    To migrate to the Stack-based APIs, use Client.newClient. For example:

    import com.twitter.finagle.Http
    
    Http.client.newClient(destination)
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  10. def configured[P](paramAndStackParam: (P, Param[P])): This

    Java friendly API for configuring the underlying Params.

    Java friendly API for configuring the underlying Params.

    The Tuple2 can often be created by calls to a mk(): (P, Stack.Param[P]) method on parameters (see com.twitter.finagle.loadbalancer.LoadBalancerFactory.Param.mk() as an example).

  11. def configured[P](param: P)(implicit stackParam: Param[P]): This

    Configure the underlying Params.

    Configure the underlying Params.

    Java users may find it easier to use the Tuple2 version below.

  12. def connectTimeout(duration: Duration): This

    The connect timeout is the timeout applied to the acquisition of a Service.

    The connect timeout is the timeout applied to the acquisition of a Service. This includes both queueing time (eg. because we cannot create more connections due to hostConnectionLimit and there are more than hostConnectionLimit requests outstanding) as well as physical connection time. Futures returned from factory() will always be satisfied within this timeout.

    This timeout is also used for name resolution, separately from queueing and physical connection time, so in the worst case the time to acquire a service may be double the given duration before timing out.

    To migrate to the Stack-based APIs, use SessionParams.acquisitionTimeout. For example:

    import com.twitter.finagle.Http
    
    Http.client.withSession.acquisitionTimeout(duration)
  13. def daemon(daemonize: Boolean): This

    When true, the client is daemonized.

    When true, the client is daemonized. As with java threads, a process can exit only when all remaining clients are daemonized. False by default.

    The default for the Stack-based APIs is for the client to be daemonized.

  14. def dest(name: Name): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    The logical destination of requests dispatched through this client.

    The logical destination of requests dispatched through this client.

    To migrate to the Stack-based APIs, use this in the call to newClient or newService. For example:

    import com.twitter.finagle.Http
    
    Http.client.newService(name)
  15. def dest(addr: String): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    The logical destination of requests dispatched through this client, as evaluated by a resolver.

    The logical destination of requests dispatched through this client, as evaluated by a resolver. If the name evaluates a label, this replaces the builder's current name.

    To migrating to the Stack-based APIs, you pass the destination to newClient or newService. If the addr is labeled, additionally, use CommonParams.withLabel

    import com.twitter.finagle.Http
    
    Http.client
      .withLabel("client_name")
      .newService(name)
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  18. def exceptionCategorizer(exceptionStatsHandler: ExceptionStatsHandler): This

    Provide an alternative to putting all request exceptions under a "failures" stat.

    Provide an alternative to putting all request exceptions under a "failures" stat. Typical implementations may report any cancellations or validation errors separately so success rate considers only valid non cancelled requests.

    To migrate to the Stack-based APIs, use CommonParams.withExceptionStatsHandler. For example:

    import com.twitter.finagle.Http
    
    Http.client.withExceptionStatsHandler(exceptionStatsHandler)
    exceptionStatsHandler

    function to record failure details.

  19. def failFast(enabled: Boolean): This

    Marks a host dead on connection failure.

    Marks a host dead on connection failure. The host remains dead until we successfully connect. Intermediate connection attempts *are* respected, but host availability is turned off during the reconnection period.

    To migrate to the Stack-based APIs, use SessionQualificationParams.noFailFast. For example:

    import com.twitter.finagle.Http
    
    Http.client.withSessionQualifier.noFailFast
  20. def failureAccrualFactory(factory: (Timer) => ServiceFactoryWrapper): This

    Completely replaces the FailureAccrualFactory from the underlying stack with the ServiceFactoryWrapper returned from the given function factory.

    Completely replaces the FailureAccrualFactory from the underlying stack with the ServiceFactoryWrapper returned from the given function factory.

    To completely disable FailureAccrualFactory use noFailureAccrual.

  21. def failureAccrualParams(pair: (Int, Duration)): This

    Use the given parameters for failure accrual.

    Use the given parameters for failure accrual. The first parameter is the number of *successive* failures that are required to mark a host failed. The second parameter specifies how long the host is dead for, once marked.

    To completely disable FailureAccrualFactory use noFailureAccrual.

  22. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  23. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def hostConnectionCoresize(value: Int): This

    The core size of the connection pool: the pool is not shrinked below this limit.

    The core size of the connection pool: the pool is not shrinked below this limit.

    To migrate to the Stack-based APIs, use SessionPoolingParams.minSize. For example:

    import com.twitter.finagle.Http
    
    Http.client.withSessionPool.minSize(value)
    Note

    not all protocol implementations support this style of connection pooling, such as com.twitter.finagle.ThriftMux and com.twitter.finagle.Memcached.

  26. def hostConnectionLimit(value: Int): ClientBuilder[Req, Rep, HasCluster, HasCodec, Yes]

    The maximum number of connections that are allowed per host.

    The maximum number of connections that are allowed per host. Required. Finagle guarantees to never have more active connections than this limit.

    To migrate to the Stack-based APIs, use SessionPoolingParams.maxSize. For example:

    import com.twitter.finagle.Http
    
    Http.client.withSessionPool.maxSize(value)
    Note

    not all protocol implementations support this style of connection pooling, such as com.twitter.finagle.ThriftMux and com.twitter.finagle.Memcached.

  27. def hosts(address: InetSocketAddress): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    A convenience method for specifying a one-host java.net.SocketAddress client.

    A convenience method for specifying a one-host java.net.SocketAddress client.

    To migrate to the Stack-based APIs, use com.twitter.finagle.Client.newService(Name, String). For the label String, use the scope you want for your StatsReceiver. For example:

    import com.twitter.finagle.{Address, Http, Name}
    
    val name: Name = Name.bound(Address(address))
    Http.client.newService(name, "the_client_name")
  28. def hosts(sockaddrs: Seq[InetSocketAddress]): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    A variant of hosts that takes a sequence of java.net.InetSocketAddress instead.

    A variant of hosts that takes a sequence of java.net.InetSocketAddress instead.

    To migrate to the Stack-based APIs, use com.twitter.finagle.Client.newService(Name, String). For the label String, use the scope you want for your StatsReceiver. For example:

    import com.twitter.finagle.{Address, Http, Name}
    
    val addresses: Seq[Address] = sockaddrs.map(Address(_))
    val name: Name = Name.bound(addresses: _*)
    Http.client.newService(name, "the_client_name")
  29. def hosts(hostnamePortCombinations: String): ClientBuilder[Req, Rep, Yes, HasCodec, HasHostConnectionLimit]

    Specify the set of hosts to connect this client to.

    Specify the set of hosts to connect this client to. Requests will be load balanced across these. This is a shorthand form for specifying a cluster.

    One of the hosts variations or direct specification of the cluster (via cluster) is required.

    To migrate to the Stack-based APIs, pass the hostname and port pairs into com.twitter.finagle.Client.newService(String). For example:

    import com.twitter.finagle.Http
    
    Http.client.newService("hostnameA:portA,hostnameB:portB")
    hostnamePortCombinations

    comma-separated "host:port" string.

  30. def httpProxy(httpProxy: SocketAddress): This

    Make connections via the given HTTP proxy.

    Make connections via the given HTTP proxy. If this is defined concurrently with socksProxy, socksProxy comes first. This means you may go through a SOCKS proxy and then an HTTP proxy, but not the other way around.

  31. def httpProxyUsernameAndPassword(credentials: Credentials): This

    For the http proxy use these Credentials for authentication.

  32. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  33. def keepAlive(value: Boolean): This

    Apply TCP keepAlive (SO_KEEPALIVE socket option).

    Apply TCP keepAlive (SO_KEEPALIVE socket option).

    To migrate to the Stack-based APIs, use configured. For example:

    import com.twitter.finagle.Http
    import com.twitter.finagle.transport.Transport.Liveness
    
    val client = Http.client
    client.configured(client.params[Transport.Liveness].copy(keepAlive = Some(value)))
  34. def loadBalancer(loadBalancer: LoadBalancerFactory): This

    Specify a load balancer.

    Specify a load balancer. The load balancer implements a strategy for choosing one host from a set to service a request.

    To migrate to the Stack-based APIs, use withLoadBalancer(LoadBalancerFactory). For example:

    import com.twitter.finagle.Http
    
    Http.client.withLoadBalancer(loadBalancer)
  35. def monitor(mFactory: (String) => Monitor): This

    To migrate to the Stack-based APIs, use CommonParams.withMonitor.

    To migrate to the Stack-based APIs, use CommonParams.withMonitor. For example:

    import com.twitter.finagle.Http
    import com.twitter.util.Monitor
    
    val monitor: Monitor = ???
    Http.client.withMonitor(monitor)
  36. def name(value: String): This

    Give a meaningful name to the client.

    Give a meaningful name to the client. Required.

    To migrate to the Stack-based APIs, use CommonParams.withLabel. For example:

    import com.twitter.finagle.Http
    
    Http.client.withLabel("my_cool_client")
  37. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  38. def noFailureAccrual: This

    Disables FailureAccrualFactory.

    Disables FailureAccrualFactory.

    To replace the FailureAccrualFactory use failureAccrualFactory.

    To migrate to the Stack-based APIs, use SessionQualificationParams.noFailureAccrual. For example:

    import com.twitter.finagle.Http
    
    Http.client.withSessionQualifier.noFailureAccrual
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. def params: Params

    The underlying Params used for configuration.

  42. def reportHostStats(receiver: StatsReceiver): This

    Report per host stats to the given StatsReceiver.

    Report per host stats to the given StatsReceiver. The statsReceiver will be scoped per client, like this: client/connect_latency_ms_max/0.0.0.0:64754

    To migrate to the Stack-based APIs, use configured. For example:

    import com.twitter.finagle.Http
    import com.twitter.finagle.loadbalancer.LoadBalancerFactory
    
    Http.client.configured(LoadBalancerFactory.HostStats(receiver))
  43. def reportTo(receiver: StatsReceiver): This

    Report stats to the given StatsReceiver.

    Report stats to the given StatsReceiver. This will report verbose global statistics and counters, that in turn may be exported to monitoring applications.

    To migrate to the Stack-based APIs, use CommonParams.withStatsReceiver. For example:

    import com.twitter.finagle.Http
    
    Http.client.withStatsReceiver(receiver)
    Note

    Per hosts statistics will NOT be exported to this receiver

    See also

    ClientBuilder.reportHostStats

  44. def requestTimeout(duration: Duration): This

    The request timeout is the time given to a *single* request (if there are retries, they each get a fresh request timeout).

    The request timeout is the time given to a *single* request (if there are retries, they each get a fresh request timeout). The timeout is applied only after a connection has been acquired. That is: it is applied to the interval between the dispatch of the request and the receipt of the response.

    To migrate to the Stack-based APIs, use CommonParams.withRequestTimeout. For example:

    import com.twitter.finagle.Http
    
    Http.client.withRequestTimeout(duration)
    Note

    if the request is not complete after duration the work that is in progress will be interrupted via Future.raise.

    See also

    timeout(Duration)

  45. def responseClassifier: ResponseClassifier

    The currently configured com.twitter.finagle.service.ResponseClassifier.

    Note

    If unspecified, the default classifier is com.twitter.finagle.service.ResponseClassifier.Default.

  46. def responseClassifier(classifier: ResponseClassifier): This

    Configure a com.twitter.finagle.service.ResponseClassifier which is used to determine the result of a request/response.

    Configure a com.twitter.finagle.service.ResponseClassifier which is used to determine the result of a request/response.

    This allows developers to give Finagle the additional application-specific knowledge necessary in order to properly classify them. Without this, Finagle cannot make judgements about application level failures as it only has a narrow understanding of failures (for example: transport level, timeouts, and nacks).

    As an example take an HTTP client that receives a response with a 500 status code back from a server. To Finagle this is a successful request/response based solely on the transport level. The application developer may want to treat all 500 status codes as failures and can do so via a com.twitter.finagle.service.ResponseClassifier.

    It is a PartialFunction and as such multiple classifiers can be composed together via PartialFunction.orElse.

    Response classification is independently configured on the client and server. For server-side response classification using com.twitter.finagle.builder.ServerBuilder, see com.twitter.finagle.builder.ServerBuilder.responseClassifier

    To migrate to the Stack-based APIs, use CommonParams.withResponseClassifier. For example:

    import com.twitter.finagle.Http
    
    Http.client.withResponseClassifier(classifier)
    Note

    If unspecified, the default classifier is com.twitter.finagle.service.ResponseClassifier.Default which is a total function fully covering the input domain.

    See also

    com.twitter.finagle.http.service.HttpResponseClassifier for some HTTP classification tools.

  47. def retries(value: Int): This

    Retry (some) failed requests up to value - 1 times.

    Retry (some) failed requests up to value - 1 times.

    Retries are only done if the request failed with something known to be safe to retry. This includes WriteExceptions and Failures that are marked retryable.

    The configured policy has jittered backoffs between retries.

    To migrate to the Stack-based APIs, use MethodBuilder. For HTTP and ThriftMux, use MethodBuilder#withMaxRetries. For all other protocols, use MethodBuilder.from(dest, stackClient) to construct a MethodBuilder manually. Then use MethodBuilder#withRetry.maxRetries to configure the max number of retries.

    For example:

    import com.twitter.finagle.Http
    import com.twitter.finagle.service.{ReqRep, ResponseClass}
    import com.twitter.util.Return
    
    Http.client
      .methodBuilder("inet!localhost:8080")
      // retry all HTTP 4xx and 5xx responses
      .withRetryForClassifier {
        case ReqRep(_, Return(rep)) if rep.statusCode >= 400 && rep.statusCode <= 599 =>
          ResponseClass.RetryableFailure
      }
      // retry up to 2 times, not including initial attempt
      .withMaxRetries(2)
    value

    the maximum number of attempts (including retries) that can be made.

    • A value of 1 means one attempt and no retries on failure.
    • A value of 2 means one attempt and then a single retry if the failure is known to be safe to retry.
    Note

    The failures seen in the client will not include application level failures. This is particularly important for codecs that include exceptions, such as Thrift. This is only applicable to service-builds (build()).

    See also

    com.twitter.finagle.service.RetryPolicy.tries

    retryBudget for governing how many failed requests are eligible for retries.

  48. def retryBudget(budget: RetryBudget, backoffSchedule: Backoff): This

    The budget is shared across requests and governs the number of retries that can be made.

    The budget is shared across requests and governs the number of retries that can be made. When used for requeues, includes a stream of delays used to delay each retry.

    Helps prevent clients from overwhelming the downstream service.

    To migrate to the Stack-based APIs, use ClientParams.withRetryBudget and ClientParams.withRetryBackoff For example:

    import com.twitter.finagle.Http
    
    Http.client
      .withRetryBudget(budget)
      .withRetryBackoff(backoffSchedule)
    See also

    retryPolicy for per-request rules on which failures are eligible for retries.

  49. def retryBudget(budget: RetryBudget): This

    The budget is shared across requests and governs the number of retries that can be made.

    The budget is shared across requests and governs the number of retries that can be made.

    Helps prevent clients from overwhelming the downstream service.

    To migrate to the Stack-based APIs, use ClientParams.withRetryBudget. For example:

    import com.twitter.finagle.Http
    
    Http.client.withRetryBudget(budget)
    See also

    retryPolicy for per-request rules on which failures are eligible for retries.

  50. def retryPolicy(value: RetryPolicy[Try[Nothing]]): This

    Retry failed requests according to the given RetryPolicy.

    Retry failed requests according to the given RetryPolicy.

    To migrate to the Stack-based APIs, use MethodBuilder. For example:

    import com.twitter.finagle.Http
    import com.twitter.finagle.service.{ReqRep, ResponseClass}
    import com.twitter.util.Return
    
    Http.client
      .methodBuilder("inet!localhost:8080")
      // retry all HTTP 4xx and 5xx responses
      .withRetryForClassifier {
        case ReqRep(_, Return(rep)) if rep.statusCode >= 400 && rep.statusCode <= 599 =>
          ResponseClass.RetryableFailure
      }
    Note

    The failures seen in the client will not include application level failures. This is particularly important for codecs that include exceptions, such as Thrift. This is only applicable to service-builds (build()).

    See also

    retryBudget for governing how many failed requests are eligible for retries.

  51. def socksProxy(socksProxy: Option[SocketAddress]): This

    Make connections via the given SOCKS proxy.

    Make connections via the given SOCKS proxy. If this is defined concurrently with httpProxy, socksProxy comes first. This means you may go through a SOCKS proxy and then an HTTP proxy, but not the other way around.

    To migrate to the Stack-based APIs, use CLI flags based configuration for SOCKS. For example:

    -Dcom.twitter.finagle.socks.socksProxyHost=127.0.0.1
    -Dcom.twitter.finagle.socks.socksProxyPort=50001
  52. def socksUsernameAndPassword(credentials: (String, String)): This

    For the socks proxy use this username for authentication.

    For the socks proxy use this username for authentication. socksPassword and socksProxy must be set as well

  53. def stack[Req1, Rep1](client: StackBasedClient[Req1, Rep1]): ClientBuilder[Req1, Rep1, HasCluster, Yes, Yes]

    Overrides the stack and com.twitter.finagle.Client that will be used by this builder.

    Overrides the stack and com.twitter.finagle.Client that will be used by this builder.

    client

    A StackBasedClient representation of a com.twitter.finagle.Client. client is materialized with the state of configuration when build is called. There is no guarantee that all builder parameters will be used by the resultant Client; it is up to the discretion of client itself and the protocol implementation. For example, the Mux protocol has no use for most connection pool parameters (e.g. hostConnectionLimit). Thus when configuring com.twitter.finagle.ThriftMux clients (via stack(ThriftMux.client)), such connection pool parameters will not be applied.

  54. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  55. def tcpConnectTimeout(duration: Duration): This

    Specify the TCP connection timeout.

    Specify the TCP connection timeout.

    To migrate to the Stack-based APIs, use ClientTransportParams.connectTimeout. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.connectTimeout(duration)
  56. def timeout(duration: Duration): This

    Total request timeout.

    Total request timeout. This timeout is applied from the issuance of a request (through service(request)) until the satisfaction of that reply future. No request will take longer than this.

    Applicable only to service-builds (build())

    To migrate to the Stack-based APIs, use MethodBuilder. For example:

    import com.twitter.finagle.Http
    
    Http.client
      .methodBuilder("inet!localhost:8080")
      .withTimeoutTotal(duration)
    Note

    if the request is not complete after duration the work that is in progress will be interrupted via Future.raise.

    See also

    requestTimeout(Duration)

  57. def tls(sslContext: SSLContext, hostname: Option[String]): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS. The Engine to use can be passed into the client. SSL/TLS Hostname Validation is performed, on the passed in hostname

  58. def tls(sslContext: SSLContext): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS. The Engine to use can be passed into the client. No SSL/TLS Hostname Validation is performed

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(sslContext)
  59. def tls(hostname: String): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS. Hostname verification will be provided against the given hostname.

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(hostname)
  60. def tls(config: SslClientConfiguration, engineFactory: SslClientEngineFactory, sessionVerifier: SslClientSessionVerifier): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS.

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(config, engineFactory, sessionVerifier)
  61. def tls(config: SslClientConfiguration, sessionVerifier: SslClientSessionVerifier): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS.

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(config, sessionVerifier)
  62. def tls(config: SslClientConfiguration, engineFactory: SslClientEngineFactory): This

    Encrypt the connection with SSL/TLS.

    Encrypt the connection with SSL/TLS.

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(config, engineFactory)
  63. def tls(config: SslClientConfiguration): This

    Encrypt the connection with SSL.

    Encrypt the connection with SSL.

    To migrate to the Stack-based APIs, use ClientTransportParams.tls. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tls(config)
  64. def tlsWithoutValidation(): This

    Do not perform TLS validation.

    Do not perform TLS validation. Probably dangerous.

    To migrate to the Stack-based APIs, use ClientTransportParams.tlsWithoutValidation. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTransport.tlsWithoutValidation
  65. def toString(): String
    Definition Classes
    ClientBuilder → AnyRef → Any
  66. def tracer(t: Tracer): This

    Specifies a tracer that receives trace events.

    Specifies a tracer that receives trace events. See com.twitter.finagle.tracing for details.

    To migrate to the Stack-based APIs, use CommonParams.withTracer. For example:

    import com.twitter.finagle.Http
    
    Http.client.withTracer(t)
  67. def trafficClass(value: Option[Int]): This

    Configures the traffic class.

    Configures the traffic class.

    See also

    Transporter.TrafficClass

  68. def unsafeBuild(): Service[Req, Rep]

    Construct a Service, with runtime checks for builder completeness.

  69. def unsafeBuildFactory(): ServiceFactory[Req, Rep]

    Construct a ServiceFactory, with runtime checks for builder completeness.

  70. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  71. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  72. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped