Enum Class TransportProtocol
- All Implemented Interfaces:
Serializable,Comparable<TransportProtocol>,Constable
This enum defines the communication mechanisms that A2A agents and clients can use to exchange messages. Each transport protocol has different characteristics, advantages, and use cases.
Supported transport protocols:
JSONRPC- JSON-RPC 2.0 over HTTP (most common, human-readable)GRPC- gRPC binary protocol (high performance, streaming)HTTP_JSON- RESTful HTTP with JSON (REST-style endpoints)
Usage example:
TransportProtocol protocol = TransportProtocol.JSONRPC;
String protocolName = protocol.asString(); // "JSONRPC"
TransportProtocol parsed = TransportProtocol.fromString("JSONRPC");
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionasString()Returns the string representation of this transport protocol.static TransportProtocolfromString(String transport) Parses a string into aTransportProtocolenum constant.static TransportProtocolReturns the enum constant of this class with the specified name.static TransportProtocol[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
JSONRPC
JSON-RPC 2.0 transport protocol over HTTP.This is the primary and most widely supported transport for the A2A Protocol. It uses JSON-RPC 2.0 request/response semantics with JSON encoding, making it human-readable and easy to debug. Supports both synchronous and streaming communication.
-
GRPC
gRPC binary transport protocol.High-performance binary protocol using Protocol Buffers for serialization. Provides efficient streaming, strong typing, and cross-language support. Suitable for high-throughput scenarios and service-to-service communication.
-
HTTP_JSON
HTTP+JSON RESTful transport protocol.REST-style HTTP endpoints with JSON payloads. Provides a more traditional web API approach compared to JSON-RPC, using HTTP methods (GET, POST, etc.) and resource-oriented URLs.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
asString
Returns the string representation of this transport protocol.Used for JSON serialization.
- Returns:
- the transport protocol name as a string
-
fromString
Parses a string into aTransportProtocolenum constant.Used for JSON deserialization.
- Parameters:
transport- the transport protocol string (e.g., "JSONRPC", "GRPC", "HTTP+JSON")- Returns:
- the corresponding TransportProtocol enum constant
- Throws:
IllegalArgumentException- if the transport string is not recognized
-