Package

com.twitter.finatra.httpclient

modules

Permalink

package modules

Visibility
  1. Public
  2. All

Type Members

  1. trait HttpClientModuleTrait extends TwitterModule with StackClientModuleTrait[Request, Response, Client]

    Permalink

    Extending this trait allows for configuring an com.twitter.finagle.Http.Client and/or a com.twitter.finatra.httpclient.HttpClient.

    Extending this trait allows for configuring an com.twitter.finagle.Http.Client and/or a com.twitter.finatra.httpclient.HttpClient.

    Example:
    1. class MyHttpClientModule
        extends HttpClientModuleTrait {
        override def dest: String = "/s/my/service"
        override def label: String = "myservice"
        override protected def sessionAcquisitionTimeout: Duration = 1.seconds
        override protected def requestTimeout: Duration = 5.seconds
        override protected def retryBudget: RetryBudget = RetryBudget(15.seconds, 5, .1)
        // if you want to customize the client configuration
        // you can:
        //
        // override def configureClient(
        //  injector: Injector,
        //  client: Http.Client
        // ): Http.Client =
        //   client.
        //     withTracer(NullTracer)
        //     withStatsReceiver(NullStatsReceiver)
        //
        // You can configure TLS on the client directly
        //
        // override def configureClient(
        //  injector: Injector,
        //  client: Http.Client
        // ): Http.Client = client.withTls("yourSslHostName")
        //
        // depending on your client type, you may want to provide a global instance,
        // otherwise you might want to specify how your consumers can provide a binding
        // for an instance to the client
        //
        // ex:
        // @Provides
        // @Singleton
        // final def provideFinagleClient(
        //   injector: Injector,
        //   statsReceiver: StatsReceiver
        // ): Http.Client = newClient(injector, statsReceiver)
        //
        // Or create a service directly
        //
        // ex:
        // @Provides
        // @Singleton
        // final def provideMyService(
        //   injector: Injector,
        //   statsReceiver: StatsReceiver
        // ): Service[Request, Response] =
        //     myCoolFilter.andThen(newService(injector, statsReceiver))
        //
        // Or provide the `com.twitter.finatra.httpclient.HttpClient`
        //
        // ex:
        // @Provides
        // @Singleton
        // final def provideMyHttpClient(
        //   injector: Injector,
        //   statsReceiver: StatsReceiver,
        //   mapper: ScalaObjectMapper
        // ): HttpClient = newHttpClient(injector, statsReceiver, mapper)
      }
    Note

    This trait does not define any @Provide annotations or bindings.

  2. abstract class HttpClientModule extends TwitterModule with HttpClientModuleTrait

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 07-08-2019) Please use com.twitter.finatra.httpclient.modules.HttpClientModuleTrait directly.

Ungrouped