pub struct OutgoingMessageContent<T, P>where
T: Serialize,{ /* private fields */ }
Implementations§
Source§impl<T> OutgoingMessageContent<T, OutgoingEventProperties>where
T: Serialize,
impl<T> OutgoingMessageContent<T, OutgoingEventProperties>where
T: Serialize,
Sourcepub fn broadcast(
payload: T,
properties: OutgoingEventProperties,
to_uri: &str,
) -> OutgoingMessage<T>
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",
);
Sourcepub fn multicast<A>(
payload: T,
properties: OutgoingEventProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Authenticable,
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"),
);
Sourcepub fn unicast<A>(
payload: T,
properties: OutgoingEventProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Addressable,
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",
);
Source§impl<T> OutgoingMessageContent<T, OutgoingRequestProperties>where
T: Serialize,
impl<T> OutgoingMessageContent<T, OutgoingRequestProperties>where
T: Serialize,
Sourcepub fn multicast<A>(
payload: T,
properties: OutgoingRequestProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Authenticable,
pub fn multicast<A>(
payload: T,
properties: OutgoingRequestProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Authenticable,
Builds a multicast request to publish.
§Arguments
payload
– any serializable value.properties
– properties of the outgoing request.to
– destination AccountId.
§Example
let props = request.properties().to_request(
"room.enter",
&Subscription::unicast_responses(),
"some_corr_data",
OutgoingShortTermTimingProperties::until_now(start_timestamp),
);
let to = AccountId::new("service_name", "svc.example.org");
let message = OutgoingRequest::multicast(json!({ "foo": "bar" }), props, &to);
Sourcepub fn unicast<A>(
payload: T,
properties: OutgoingRequestProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Addressable,
pub fn unicast<A>(
payload: T,
properties: OutgoingRequestProperties,
to: &A,
version: &str,
) -> OutgoingMessage<T>where
A: Addressable,
Builds a unicast request to publish.
§Arguments
payload
– any serializable value.properties
– properties of the outgoing request.to
– destination AgentId.version
– destination agent’s API version.
§Example
let props = request.properties().to_request(
"room.enter",
&Subscription::unicast_responses(),
"some_corr_data",
OutgoingShortTermTimingProperties::until_now(start_timestamp),
);
let to = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let message = OutgoingRequest::unicast(json!({ "foo": "bar" }), props, to, "v1");
Source§impl<T> OutgoingMessageContent<T, OutgoingResponseProperties>where
T: Serialize,
impl<T> OutgoingMessageContent<T, OutgoingResponseProperties>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");
Source§impl<T, P> OutgoingMessageContent<T, P>where
T: Serialize,
impl<T, P> OutgoingMessageContent<T, P>where
T: Serialize,
pub fn properties(&self) -> &P
Trait Implementations§
Auto Trait Implementations§
impl<T, P> Freeze for OutgoingMessageContent<T, P>
impl<T, P> RefUnwindSafe for OutgoingMessageContent<T, P>where
T: RefUnwindSafe,
P: RefUnwindSafe,
impl<T, P> Send for OutgoingMessageContent<T, P>
impl<T, P> Sync for OutgoingMessageContent<T, P>
impl<T, P> Unpin for OutgoingMessageContent<T, P>
impl<T, P> UnwindSafe for OutgoingMessageContent<T, P>where
T: UnwindSafe,
P: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more