Class NacosA2aTransportPropertiesEnvParser

java.lang.Object
io.agentscope.core.nacos.a2a.registry.NacosA2aTransportPropertiesEnvParser

public class NacosA2aTransportPropertiesEnvParser extends Object
Parser for NacosA2aRegistryTransportProperties from Environment.

The ENV of A2A transport properties is prefixed with Constants.PROPERTIES_ENV_PREFIX, and is appended with {TRANSPORT} and {ATTRIBUTE}. Such as `NACOS_A2A_AGENT_JSONRPC_HOST=127.0.0.1`.

This parser will parse the environment variables which are prefixed with Constants.PROPERTIES_ENV_PREFIX and convert them into NacosA2aRegistryTransportProperties. These variables will be split by `_` excluding the prefix and the first part is the transport name, the second part is the attribute name. If there are duplicate keys in the environment variables, the last one will be used.

See Also:
  • Constructor Details

    • NacosA2aTransportPropertiesEnvParser

      public NacosA2aTransportPropertiesEnvParser()
  • Method Details

    • getTransportProperties

      public Map<String,NacosA2aRegistryTransportProperties> getTransportProperties()
      Retrieves transport properties from environment variables and converts them to a map of NacosA2aRegistryTransportProperties.

      This method scans all environment variables that start with the predefined prefix, parses them according to the expected format, and converts them into NacosA2aRegistryTransportProperties objects. The environment variables should follow the format PREFIX_TRANSPORT_ATTRIBUTE=value.

      Returns:
      a map where keys are transport names and values are corresponding NacosA2aRegistryTransportProperties objects