pub struct MessageEnvelope {
pub protocol_version: String,
pub message: A2AMessage,
pub trace: Option<TraceContext>,
pub owner: Option<String>,
pub headers: HashMap<String, String>,
}Expand description
Transport-neutral message envelope shared across HTTP and gRPC (P2-8).
A2A messages carry identical semantics over JSON-RPC/HTTP and (future) gRPC; this envelope is the common representation so a message produced on one transport can be handed to the other without reshaping. It bundles the message with the cross-cutting metadata that would otherwise live in an HTTP header or a gRPC field: W3C trace context, caller identity, and arbitrary application headers.
Fields§
§protocol_version: StringProtocol version this envelope conforms to.
message: A2AMessageThe message payload.
trace: Option<TraceContext>W3C trace context carried on the message (P2-8).
owner: Option<String>Caller / organization identity (P1-4).
headers: HashMap<String, String>Arbitrary application-defined headers.
Implementations§
Source§impl MessageEnvelope
impl MessageEnvelope
Sourcepub fn new(message: A2AMessage) -> Self
pub fn new(message: A2AMessage) -> Self
Wrap a message in a fresh envelope for the current protocol version.
Sourcepub fn with_trace(self, trace: TraceContext) -> Self
pub fn with_trace(self, trace: TraceContext) -> Self
Attach the W3C trace context (P2-8).
Sourcepub fn with_owner(self, owner: impl Into<String>) -> Self
pub fn with_owner(self, owner: impl Into<String>) -> Self
Attach the caller / organization identity (P1-4).
Sourcepub fn with_header(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_header( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Attach an application-defined header.
Sourcepub fn into_message(self) -> A2AMessage
pub fn into_message(self) -> A2AMessage
Unwrap into the bare message.
Trait Implementations§
Source§impl Clone for MessageEnvelope
impl Clone for MessageEnvelope
Source§fn clone(&self) -> MessageEnvelope
fn clone(&self) -> MessageEnvelope
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more