Interface A2AHttpClientProvider

All Known Implementing Classes:
AndroidA2AHttpClientProvider, CdiA2AHttpClientProvider, JdkA2AHttpClientProvider, VertxA2AHttpClientProvider

public interface A2AHttpClientProvider
Service provider interface for creating A2AHttpClient instances.

Implementations of this interface can be registered via the Java ServiceLoader mechanism. The A2AHttpClientFactory discovers all registered providers, sorts them by descending priority(), and tries each in order, returning the first one whose create() succeeds.

To register a provider, create a file named META-INF/services/org.a2aproject.sdk.client.http.A2AHttpClientProvider containing the fully qualified class name of your provider implementation.

  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new instance of an A2AHttpClient.
    Returns the name of this provider for logging and debugging purposes.
    default int
    Returns the priority of this provider.
  • Method Details

    • create

      A2AHttpClient create()
      Creates a new instance of an A2AHttpClient.
      Returns:
      a new A2AHttpClient instance
    • priority

      default int priority()
      Returns the priority of this provider. Higher priority providers are tried first; the first one whose create() succeeds is used.

      Built-in priorities (for reference when choosing a custom value):

      • CdiA2AHttpClient: 200 (CDI-provided bean, when a container and bean are active)
      • AndroidA2AHttpClient: 110 (Android runtime only)
      • VertxA2AHttpClient: 100 (when vertx-web-client is on the classpath)
      • JdkA2AHttpClient: 0 (always available, last resort)
      Returns:
      the priority value (higher is better)
    • name

      String name()
      Returns the name of this provider for logging and debugging purposes.
      Returns:
      the provider name