Struct svc_agent::Subscription[][src]

pub struct Subscription {}
Expand description

Messages subscription builder.

Implementations

Builds an EventSubscription for broadcast events.

Use it to subscribe to events from some service,

Arguments

  • from – anything Addressable to receive events from. For example service AgentId.
  • version – API version string of the from agent. Example: v1.
  • uri – resource path divided by / to receive events on. Example: room/ROOM_ID/events.

Example

let agent = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let subscription = Subscription::broadcast_events(&agent, "v1", "rooms/123/events");

Builds a RequestSubscription for multicast requests from any agent.

Use it to subscribe a stateless service endpoint to its consumers’ requests.

Arguments

  • version – API version string of the from agent. Example: v1.

Example

let subscription = Subscription::multicast_requests("v1");

Builds a RequestSubscription for multicast requests from a specific agent.

This is the same as multicast_requests but subscribes only from requests from a specific agent.

Arguments

  • from – anything Addressable to receive requests from. For example service AgentId.
  • version – API version string of the from agent. Example: v1.

Example

let agent = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let subscription = Subscription::multicast_requests_from(&agent, "v1");

Builds a RequestSubscription for unicast requests from any agent.

Use it to subscribe a stateful service endpoint to its consumers’ requests.

Example

let subscription = Subscription::unicast_requests();

Builds a RequestSubscription for unicast requests from a specific agent.

This is the same as unicast_requests but subscribes only from requests from a specific agent.

Arguments

Example

let agent = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let subscription = Subscription::unicast_requests(&agent);

Builds a ResponseSubscription for unicast requests from any agent.

Use it to subscribe to responses from all services.

Example

let subscription = Subscription::unicast_responses();

Builds a ResponseSubscription for unicast requests from a specific agent.

This is the same as unicast_responses but subscribes only from requests from a specific agent.

Example

let agent = AgentId::new("instance01", AccountId::new("service_name", "svc.example.org"));
let subscription = Subscription::unicast_responses_from(&agent);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.