in inject/inject-thrift-client/src/main/scala/com/twitter/inject/thrift/modules/ThriftMethodBuilderClientModule.scala [72:124]
protected def configureMethodBuilder(
injector: Injector,
methodBuilder: thriftmux.MethodBuilder
): thriftmux.MethodBuilder = methodBuilder
/**
* Configure the ServicePerEndpoint. This is done by using the given [[ThriftMethodBuilderFactory]]
* to configure a [[com.twitter.inject.thrift.ThriftMethodBuilder]] for a given ThriftMethod. E.g.,
*
* {{{
* servicePerEndpoint
* .withFetchBlob(
* builder.method(FetchBlob)
* ...
* }}}
*
* Subclasses of this module MAY provide an implementation of `configureServicePerEndpoint` which
* specifies configuration of a `ServicePerEndpoint` interface per-method of the interface.
*
* @param injector a [[com.twitter.inject.Injector]] instance
* @param builder a [[ThriftMethodBuilderFactory]] for creating a [[com.twitter.inject.thrift.ThriftMethodBuilder]].
* @param servicePerEndpoint the [[ServicePerEndpoint]] to configure.
* @return a per-method filtered [[ServicePerEndpoint]]
* @see [[com.twitter.inject.thrift.ThriftMethodBuilder]]
*/
protected def configureServicePerEndpoint(
injector: Injector,
builder: ThriftMethodBuilderFactory[ServicePerEndpoint],
servicePerEndpoint: ServicePerEndpoint
): ServicePerEndpoint = servicePerEndpoint
override protected final def initialClientConfiguration(
injector: Injector,
client: ThriftMux.Client,
statsReceiver: StatsReceiver
): ThriftMux.Client =
super
.initialClientConfiguration(injector, client, statsReceiver)
.withPerEndpointStats
override protected final def scopeStatsReceiver(
injector: Injector,
statsReceiver: StatsReceiver
): StatsReceiver = super.scopeStatsReceiver(injector, statsReceiver)
@Provides
@Singleton
final def providesMethodPerEndpoint(
servicePerEndpoint: ServicePerEndpoint
): MethodPerEndpoint = {
ThriftMux.Client
.methodPerEndpoint[ServicePerEndpoint, MethodPerEndpoint](servicePerEndpoint)
}