Class JSONRPCTransportConfig

java.lang.Object
org.a2aproject.sdk.client.transport.spi.ClientTransportConfig<JSONRPCTransport>
org.a2aproject.sdk.client.transport.jsonrpc.JSONRPCTransportConfig

public class JSONRPCTransportConfig extends ClientTransportConfig<JSONRPCTransport>
Configuration for the JSON-RPC transport protocol.

This configuration class allows customization of the HTTP client used for JSON-RPC communication with A2A agents. If no HTTP client is specified, the default JDK-based implementation is used.

Basic usage:

// Use default HTTP client
JSONRPCTransportConfig config = new JSONRPCTransportConfigBuilder()
    .build();

Client client = Client.builder(agentCard)
    .withTransport(JSONRPCTransport.class, config)
    .build();

Custom HTTP client:

// Custom HTTP client with timeouts
A2AHttpClient customClient = new CustomHttpClient()
    .withConnectTimeout(Duration.ofSeconds(10))
    .withReadTimeout(Duration.ofSeconds(30));

JSONRPCTransportConfig config = new JSONRPCTransportConfigBuilder()
    .httpClient(customClient)
    .build();

With interceptors:

JSONRPCTransportConfig config = new JSONRPCTransportConfigBuilder()
    .httpClient(customClient)
    .addInterceptor(new LoggingInterceptor())
    .addInterceptor(new AuthInterceptor("Bearer token"))
    .build();
See Also:
  • Constructor Details

    • JSONRPCTransportConfig

      public JSONRPCTransportConfig()
      Create a JSON-RPC transport configuration with the default HTTP client.

      The default JDK-based HTTP client will be used. Consider using JSONRPCTransportConfigBuilder instead for a more fluent API.

    • JSONRPCTransportConfig

      public JSONRPCTransportConfig(A2AHttpClient httpClient)
      Create a JSON-RPC transport configuration with a custom HTTP client.

      Consider using JSONRPCTransportConfigBuilder instead for a more fluent API.

      Parameters:
      httpClient - the HTTP client to use for JSON-RPC requests
  • Method Details

    • getHttpClient

      public @Nullable A2AHttpClient getHttpClient()
      Get the configured HTTP client.
      Returns:
      the HTTP client, or null if using the default