Type Definition svc_agent::mqtt::OutgoingResponse
source · pub type OutgoingResponse<T> = OutgoingMessageContent<T, OutgoingResponseProperties>;
Implementations§
source§impl<T> OutgoingResponse<T>where
T: Serialize,
impl<T> OutgoingResponse<T>where T: Serialize,
sourcepub fn unicast<A>(
payload: T,
properties: OutgoingResponseProperties,
to: &A,
version: &str
) -> OutgoingMessage<T>where
A: Addressable,
pub fn unicast<A>( payload: T, properties: OutgoingResponseProperties, to: &A, version: &str ) -> OutgoingMessage<T>where A: Addressable,
Builds a unicast response to publish.
Arguments
payload
– any serializable value.properties
– properties of the outgoing response.to
– destination AgentId.version
– destination agent’s API version.
Example
let short_term_timing = OutgoingShortTermTimingProperties::until_now(start_timestamp);
let props = request.properties().to_response(ResponseStatus::OK, short_term_timing)
let to = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let message = OutgoingResponse::unicast(json!({ "foo": "bar" }), props, to, "v1");
Trait Implementations§
source§impl<T> IntoEnvelope for OutgoingResponse<T>where
T: Serialize,
impl<T> IntoEnvelope for OutgoingResponse<T>where T: Serialize,
source§fn into_envelope(self) -> Result<OutgoingEnvelope, Error>
fn into_envelope(self) -> Result<OutgoingEnvelope, Error>
Wraps an outgoing message into envelope format.