TransportWrapper
public interface TransportWrapper<T, R>
源码Source
io/agentscope/core/a2a/server/transport/TransportWrapper.java:28–46定义传输层包装器契约的接口。位于 io.agentscope.core.a2a.server.transport 包。核心成员包括 getTransportType、handleRequest。
The interface for different A2A transports, such as JSON-RPC, GRPC, REST and other custom transports to
separate the access requests and handle requests.
Developers should get request body and headers from request by endpoint(Controller, Route, StreamObserver and so on), then call target implementation of this interface to actual handle target transport.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getTransportType() | 获取包装器传输层类型名称。 Get wrapper transport type name. |
public R handleRequest(T body, Map<String, String> headers, Map<String, Object> metadata) | 处理请求。 Do handle for target transport request, including streaming and non-streaming request. |
方法详情Method Detail
getTransportType
public String getTransportType()
获取包装器传输层类型名称。
Get wrapper transport type name.
String传输层类型的名称。name of transport type
源码Source
io/agentscope/core/a2a/server/transport/TransportWrapper.java:35handleRequest
public R handleRequest(T body, Map<String, String> headers, Map<String, Object> metadata)
处理请求。
Do handle for target transport request, including streaming and non-streaming request.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
body | T | 正文(类型 `T`)。transport request body |
headers | Map<String, String> | 请求头(类型 `Map`)。transport request headers map |
metadata | Map<String, Object> | 元数据(类型 `Map`)。Other transport request metadata from request or developer |
R返回R。Different response for different transport request
源码Source
io/agentscope/core/a2a/server/transport/TransportWrapper.java:45