Type Definition svc_agent::mqtt::OutgoingEvent

source ·
pub type OutgoingEvent<T> = OutgoingMessageContent<T, OutgoingEventProperties>;

Implementations§

source§

impl<T> OutgoingEvent<T>where T: Serialize,

source

pub fn broadcast( payload: T, properties: OutgoingEventProperties, to_uri: &str ) -> OutgoingMessage<T>

Builds a broadcast event to publish.

Arguments
  • payload – any serializable value.
  • properties – properties of the outgoing event.
  • to_uri – broadcast resource path. See Destination for details.
Example
let short_term_timing = OutgoingShortTermTimingProperties::until_now(start_timestamp);

let message = OutgoingEvent::broadcast(
    json!({ "foo": "bar" }),
    request.to_event("message.create", short_term_timing),
    "rooms/123/events",
);
source

pub fn multicast<A>( payload: T, properties: OutgoingEventProperties, to: &A, version: &str ) -> OutgoingMessage<T>where A: Authenticable,

Builds a multicast event to publish.

Arguments
  • payload – any serializable value.
  • properties – properties of the outgoing event.
  • to – destination AccountId.
Example
let short_term_timing = OutgoingShortTermTimingProperties::until_now(start_timestamp);

let message = OutgoingRequest::multicast(
    json!({ "foo": "bar" }),
    request.to_event("message.create", short_term_timing),
    &AccountId::new("service_name", "svc.example.org"),
);
source

pub fn unicast<A>( payload: T, properties: OutgoingEventProperties, to: &A, version: &str ) -> OutgoingMessage<T>where A: Addressable,

Builds a unicast event to publish.

Arguments
  • payload – any serializable value.
  • properties – properties of the outgoing event.
  • to – destination AgentId.
  • version – destination agent’s API version.
Example
let short_term_timing = OutgoingShortTermTimingProperties::until_now(start_timestamp);

let message = OutgoingRequest::multicast(
    json!({ "foo": "bar" }),
    request.to_event("message.create", short_term_timing),
    &AgentId::new("instance01", AccountId::new("service_name", "svc.example.org")),
    "v1",
);

Trait Implementations§

source§

impl<T> IntoEnvelope for OutgoingEvent<T>where T: Serialize,

source§

fn into_envelope(self) -> Result<OutgoingEnvelope, Error>

Wraps an outgoing message into envelope format.
source§

impl<T: Serialize> Publishable for OutgoingEvent<T>

source§

fn destination_topic(&self, publisher: &Address) -> Result<String, Error>

Returns a destination topic as string. Read more
source§

fn qos(&self) -> QoS

Returns QoS for publishing.