Class JSONRPCTransportConfig

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

public class JSONRPCTransportConfig extends org.a2aproject.sdk.client.transport.spi.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:
  • Field Summary

    Fields inherited from class org.a2aproject.sdk.client.transport.spi.ClientTransportConfig

    interceptors, parameters
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a JSON-RPC transport configuration with the default HTTP client.
    JSONRPCTransportConfig(org.a2aproject.sdk.client.http.A2AHttpClient httpClient)
    Create a JSON-RPC transport configuration with a custom HTTP client.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable org.a2aproject.sdk.client.http.A2AHttpClient
    Get the configured HTTP client.

    Methods inherited from class org.a2aproject.sdk.client.transport.spi.ClientTransportConfig

    getInterceptors, getParameters, setInterceptors, setParameters

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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(org.a2aproject.sdk.client.http.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 org.a2aproject.sdk.client.http.A2AHttpClient getHttpClient()
      Get the configured HTTP client.
      Returns:
      the HTTP client, or null if using the default