package modules
Ordering
- Alphabetic
Visibility
- Public
- Protected
Type Members
- trait StackClientModuleTrait[Req, Rep, ClientType <: StackBasedClient[Req, Rep] with Parameterized[ClientType] with CommonParams[ClientType] with ClientParams[ClientType] with WithClientSession[ClientType]] extends TwitterModule
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.
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
Extending this module for HTTP and ThriftMux clients should not be necessary, as there are fully supported modules for creating those clients.
,The ordering of client configuration may be important. The underlying clients will be configured and created in the following order: baseClient -> initialClientConfiguration -> configureClient -> frameworkConfigureClient
Example:
Value Members
- object StackTransformerModule extends TwitterModule
Provides a com.twitter.inject.StackTransformer to the dependency injection context.
- object StatsReceiverModule extends TwitterModule
- object TracerModule extends TwitterModule