Class ClientTransportConfig<T extends ClientTransport>
- Type Parameters:
T- the transport type this configuration is for
This abstract class provides common configuration functionality for all transport implementations (JSON-RPC, gRPC, REST). It manages request/response interceptors that can be used for logging, metrics, authentication, and other cross-cutting concerns.
Interceptors: Transport configurations support adding interceptors that can inspect and modify requests/responses. Interceptors are invoked in the order they were added:
// Example: Add logging and authentication interceptors
config.setInterceptors(List.of(
new LoggingInterceptor(),
new AuthenticationInterceptor("Bearer token")
));
Concrete implementations typically extend this class to add transport-specific configuration such as HTTP clients, gRPC channels, or connection pools.
Thread safety: Configuration instances should be treated as immutable after construction. The interceptor list is copied defensively to prevent external modification.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the list of configured interceptors.Get the list of configured parameters.voidsetInterceptors(List<ClientCallInterceptor> interceptors) Set the list of request/response interceptors.voidsetParameters(Map<String, ? extends Object> parameters) Set the Map of config parameters.
-
Field Details
-
interceptors
-
parameters
-
-
Constructor Details
-
ClientTransportConfig
public ClientTransportConfig()
-
-
Method Details
-
setInterceptors
Set the list of request/response interceptors.Interceptors are invoked in the order they appear in the list, allowing for controlled processing chains (e.g., authentication before logging).
The provided list is copied to prevent external modifications from affecting this configuration.
- Parameters:
interceptors- the list of interceptors to use (will be copied)- See Also:
-
getInterceptors
Get the list of configured interceptors.Returns an unmodifiable view of the interceptor list. Attempting to modify the returned list will throw
UnsupportedOperationException.- Returns:
- an unmodifiable list of configured interceptors (never null, but may be empty)
-
setParameters
Set the Map of config parameters. The provided map is copied to prevent external modifications from affecting this configuration.- Parameters:
parameters- the map of parameters to use (will be copied)
-
getParameters
Get the list of configured parameters.Returns an unmodifiable view of the parameters map. Attempting to modify the returned map will throw
UnsupportedOperationException.- Returns:
- an unmodifiable map of configured parameters (never null, but may be empty)
-