Class A2AProtocolSerializer
java.lang.Object
com.mulesoft.connectors.a2a.internal.protocol.A2AProtocolSerializer
- All Implemented Interfaces:
org.mule.runtime.api.lifecycle.Initialisable
public class A2AProtocolSerializer
extends Object
implements org.mule.runtime.api.lifecycle.Initialisable
-
Field Summary
Fields inherited from interface org.mule.runtime.api.lifecycle.Initialisable
PHASE_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractMessageFromParams(String paramsJson) Extracts taskId from A2A message structure in params JSON.extractPushNotificationConfigJson(String fullParamsJson) extractTaskIdForPushNotificationConfig(String paramsJson) Extracts taskId for push notification config set method.Extracts the taskQueryParams with {id an pushNotificationConfigId} and transforms into TaskIdParams/TaskQueryParams for push notification get/list/delete usagegetTaskQueryParams(String params) voidparseAgentCard(String json) parseResult(String json) toAgentCardJson(AgentCard agentCard) transformPushNotificationConfigListResponse(String taskId, List<EffectivePushNotificationConfig> pushConfigs) Transforms push notification configs data into the proper response format.transformPushNotificationConfigResponse(String taskId, EffectivePushNotificationConfig pushConfig) Transforms push notification config data into the proper response format.transformTaskHistoryResponse(String taskHistoryJson, int historyLength)
-
Constructor Details
-
A2AProtocolSerializer
public A2AProtocolSerializer()
-
-
Method Details
-
getJsonMessageFromResult
-
parseResult
-
getJsonMessageFromRequest
-
getTaskQueryParams
-
transformTaskHistoryResponse
-
transformPushNotificationConfigResponse
public String transformPushNotificationConfigResponse(String taskId, EffectivePushNotificationConfig pushConfig) Transforms push notification config data into the proper response format.- Parameters:
taskId- The task IDpushConfig- The push notification configuration- Returns:
- The transformed response as JSON string
-
transformPushNotificationConfigListResponse
public String transformPushNotificationConfigListResponse(String taskId, List<EffectivePushNotificationConfig> pushConfigs) Transforms push notification configs data into the proper response format.- Parameters:
taskId- The task IDpushConfigs- The push notification configurations for taskId- Returns:
- The transformed response as JSON string
-
extractMessageFromParams
Extracts taskId from A2A message structure in params JSON. Looks for taskId in params.message.taskId structure.- Parameters:
paramsJson- The JSON string containing the request parameters- Returns:
- The taskId if found, null otherwise
-
extractTaskIdForPushNotificationConfig
Extracts taskId for push notification config set method. Looks for taskId at the top level of params.- Parameters:
paramsJson- The JSON string containing the request parameters- Returns:
- The taskId if found, null otherwise
-
toAgentCardJson
public String toAgentCardJson(AgentCard agentCard) throws AgentCardDiscoveryException.InvalidAgentCardException -
parseAgentCard
-
parsePushNotificationConfig
-
extractPushNotificationConfigJson
-
getTaskPushNotificationConfigParams
Extracts the taskQueryParams with {id an pushNotificationConfigId} and transforms into TaskIdParams/TaskQueryParams for push notification get/list/delete usage- Parameters:
params- from the json rpc request- Returns:
- JsonRpcResult with the result field as TaskIdParams/TaskQueryParams
-
initialise
public void initialise()- Specified by:
initialisein interfaceorg.mule.runtime.api.lifecycle.Initialisable
-