Class ClientTransportConfig<T extends ClientTransport>

java.lang.Object
org.a2aproject.sdk.client.transport.spi.ClientTransportConfig<T>
Type Parameters:
T - the transport type this configuration is for

public abstract class ClientTransportConfig<T extends ClientTransport> extends Object
Base configuration class for A2A client transport protocols.

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.

See Also:
  • Field Details

  • Constructor Details

    • ClientTransportConfig

      public ClientTransportConfig()
  • Method Details

    • setInterceptors

      public void setInterceptors(List<ClientCallInterceptor> interceptors)
      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

      public List<ClientCallInterceptor> 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

      public void setParameters(Map<String,? extends Object> parameters)
      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

      public Map<String,? extends Object> 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)