pub struct JsonRpcTransport { /* private fields */ }Expand description
JSON-RPC 2.0 transport: HTTP POST to a single endpoint.
Create via JsonRpcTransport::new or let crate::ClientBuilder
construct one automatically from the agent card.
Implementations§
Source§impl JsonRpcTransport
impl JsonRpcTransport
Sourcepub fn new(endpoint: impl Into<String>) -> Result<JsonRpcTransport, ClientError>
pub fn new(endpoint: impl Into<String>) -> Result<JsonRpcTransport, ClientError>
Creates a new transport targeting the given endpoint URL.
The endpoint is typically the url field from an a2a_protocol_types::AgentCard.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeout(
endpoint: impl Into<String>,
request_timeout: Duration,
) -> Result<JsonRpcTransport, ClientError>
pub fn with_timeout( endpoint: impl Into<String>, request_timeout: Duration, ) -> Result<JsonRpcTransport, ClientError>
Creates a new transport with a custom request timeout.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_timeouts(
endpoint: impl Into<String>,
request_timeout: Duration,
stream_connect_timeout: Duration,
) -> Result<JsonRpcTransport, ClientError>
pub fn with_timeouts( endpoint: impl Into<String>, request_timeout: Duration, stream_connect_timeout: Duration, ) -> Result<JsonRpcTransport, ClientError>
Creates a new transport with separate request and stream connect timeouts.
Uses the default TCP connection timeout (10 seconds).
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_all_timeouts(
endpoint: impl Into<String>,
request_timeout: Duration,
stream_connect_timeout: Duration,
connection_timeout: Duration,
) -> Result<JsonRpcTransport, ClientError>
pub fn with_all_timeouts( endpoint: impl Into<String>, request_timeout: Duration, stream_connect_timeout: Duration, connection_timeout: Duration, ) -> Result<JsonRpcTransport, ClientError>
Creates a new transport with all timeout parameters.
connection_timeout is applied to the underlying TCP connector (DNS +
handshake), preventing indefinite hangs when the server is unreachable.
§Errors
Returns ClientError::InvalidEndpoint if the URL is malformed.
Sourcepub fn with_send_timeout(self, timeout: Duration) -> JsonRpcTransport
pub fn with_send_timeout(self, timeout: Duration) -> JsonRpcTransport
Sets how long a blocking SendMessage (one without
return_immediately) may wait for the agent’s turn to end; see
DEFAULT_SEND_TIMEOUT.
Sourcepub fn with_max_response_size(self, max_bytes: usize) -> JsonRpcTransport
pub fn with_max_response_size(self, max_bytes: usize) -> JsonRpcTransport
Sets the maximum size in bytes of a buffered (non-streaming) response body. Responses exceeding the cap fail with a non-retryable transport error instead of being buffered without bound.
Defaults to 32 MiB.
Trait Implementations§
Source§impl Clone for JsonRpcTransport
impl Clone for JsonRpcTransport
Source§fn clone(&self) -> JsonRpcTransport
fn clone(&self) -> JsonRpcTransport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JsonRpcTransport
impl Debug for JsonRpcTransport
Source§impl Transport for JsonRpcTransport
impl Transport for JsonRpcTransport
Source§fn send_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
Source§fn send_streaming_request<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
fn send_streaming_request<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
EventStream. Read moreSource§fn send_request_with_query<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
query: &'a [(String, String)],
) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
fn send_request_with_query<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, query: &'a [(String, String)], ) -> Pin<Box<dyn Future<Output = Result<Value, ClientError>> + Send + 'a>>
send_request with query appended to the
request URL, as an API key placed in the query string needs (a2a.proto
APIKeySecurityScheme.location: “query”, “header”, or “cookie”; audit
register R67). Read moreSource§fn send_streaming_request_with_query<'a>(
&'a self,
method: &'a str,
params: Value,
extra_headers: &'a HashMap<String, String>,
query: &'a [(String, String)],
) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
fn send_streaming_request_with_query<'a>( &'a self, method: &'a str, params: Value, extra_headers: &'a HashMap<String, String>, query: &'a [(String, String)], ) -> Pin<Box<dyn Future<Output = Result<EventStream, ClientError>> + Send + 'a>>
Source§fn rpc_system(&self) -> Option<&'static str>
fn rpc_system(&self) -> Option<&'static str>
rpc.system.name of this transport’s calls, which each call’s
CLIENT span carries when the transport was given to
ClientBuilder::with_custom_transport
(ADR 0013). The default, None, records none. The semantic
conventions name jsonrpc and grpc; a binding they do not list
uses its own name in lower case (slimrpc). A transport the builder
makes for a card’s binding is named by the builder, not by this.Source§fn server_url(&self) -> Option<&str>
fn server_url(&self) -> Option<&str>
rpc.client.call.duration take server.address and server.port
when the transport was given to
ClientBuilder::with_custom_transport.
The default, None, records neither, so a dashboard cannot tell this
client’s agents apart; a transport whose peer has no URL (SLIMRPC
names a SLIM identity) takes it. A transport the builder makes for a
card’s binding is addressed by the builder, not by this.Auto Trait Implementations§
impl !RefUnwindSafe for JsonRpcTransport
impl !UnwindSafe for JsonRpcTransport
impl Forget for JsonRpcTransport
impl Freeze for JsonRpcTransport
impl Move for JsonRpcTransport
impl Send for JsonRpcTransport
impl Sync for JsonRpcTransport
impl Unpin for JsonRpcTransport
impl UnsafeUnpin for JsonRpcTransport
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].