pub trait Pubsub: Send + Sync + 'static {
    type SubscribeStream: Stream<Item = Result<SubscriptionItem, Status>> + Send + 'static;

    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PublishRequest>
    ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SubscriptionRequest>
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::SubscribeStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with PubsubServer.

Required Associated Types§

source

type SubscribeStream: Stream<Item = Result<SubscriptionItem, Status>> + Send + 'static

Server streaming response type for the Subscribe method.

Required Methods§

source

fn publish<'life0, 'async_trait>( &'life0 self, request: Request<PublishRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Publish a message to a topic.

If a topic has no subscribers, then the effect of Publish MAY be either of:

  • It is dropped and the topic is nonexistent.
  • It is accepted to the topic as the next message.

Publish() does not wait for subscribers to accept. It returns Ok upon accepting the topic value. It also returns Ok if there are no subscribers and the value happens to be dropped. Publish() can not guarantee delivery in theory but in practice it should almost always deliver to subscribers.

REQUIRES HEADER authorization: Momento auth token

source

fn subscribe<'life0, 'async_trait>( &'life0 self, request: Request<SubscriptionRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::SubscribeStream>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Subscribe to notifications from a topic.

You will receive a stream of values and (hopefully occasional) discontinuities. Values will appear as copies of the payloads you Publish() to the topic.

REQUIRES HEADER authorization: Momento auth token

Implementors§