Package

com.twitter.inject

modules

Permalink

package modules

Visibility
  1. Public
  2. All

Type Members

  1. trait StackClientModuleTrait[Req, Rep, ClientType <: StackBasedClient[Req, Rep] with Parameterized[ClientType] with CommonParams[ClientType] with ClientParams[ClientType] with WithClientSession[ClientType]] extends TwitterModule

    Permalink

    A module for configuring a Finagle StackBasedClient.

    A module for configuring a Finagle StackBasedClient. Binding is explicitly not handled by this trait and implementors are responsible for managing their own binding annotations.

    Example:
    1. abstract class MyClientModule
        extends StackClientModuleTrait[Request, Response, MyClient] {
        override protected final def baseClient: MyClient = MyClient.client
        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: MyClient): MyClient =
        //   client.
        //     withTracer(NullTracer)
        //     withStatsReceiver(NullStatsReceiver)
        //
        // 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 provideMyClient(
        //   injector: Injector,
        //   statsReceiver: StatsReceiver
        //  ): MyClient =
        //    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))
      }
    Note

    The ordering of client configuration may be important. The underlying clients will be configured and created in the following order: baseClient -> initialClientConfiguration -> configureClient -> frameworkConfigureClient

    ,

    Extending this module for HTTP and ThriftMux clients should not be necessary, as there are fully supported modules for creating those clients.

Value Members

  1. object LoggerModule extends TwitterModule

    Permalink

    A com.twitter.inject.TwitterModule which attempts to install the SLF4JBridgeHandler when the slf4j-jdk14 logging implementation is not present on the classpath.

    A com.twitter.inject.TwitterModule which attempts to install the SLF4JBridgeHandler when the slf4j-jdk14 logging implementation is not present on the classpath.

    See also

    com.twitter.util.logging.Slf4jBridgeUtility

  2. object StackTransformerModule extends TwitterModule

    Permalink

    Provides a com.twitter.inject.StackTransformer to the dependency injection context.

  3. object StatsReceiverModule extends TwitterModule

    Permalink

Ungrouped