wasmcloud_runtime::component

Trait MessagingHostMessage0_3

source
pub trait MessagingHostMessage0_3 {
    // Required methods
    fn topic<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Topic>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn content_type<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_content_type<'life0, 'async_trait>(
        &'life0 mut self,
        content_type: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn data<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_data<'life0, 'async_trait>(
        &'life0 mut self,
        buf: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn metadata<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Metadata>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn add_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        key: String,
        value: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        meta: Metadata,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_metadata<'life0, 'async_trait>(
        &'life0 mut self,
        key: String,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn as_any(&self) -> &dyn Any;
    fn into_any(self: Box<Self>) -> Box<dyn Any>;
}
Expand description

A message with a binary payload and additional information

Required Methods§

source

fn topic<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Topic>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The topic/subject/channel this message was received on

source

fn content_type<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An optional content-type describing the format of the data in the message. This is sometimes described as the “format” type

source

fn set_content_type<'life0, 'async_trait>( &'life0 mut self, content_type: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the content-type describing the format of the data in the message. This is sometimes described as the “format” type

source

fn data<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

An opaque blob of data

source

fn set_data<'life0, 'async_trait>( &'life0 mut self, buf: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the opaque blob of data for this message, discarding the old value

source

fn metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<Metadata>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Optional metadata (also called headers or attributes in some systems) attached to the message. This metadata is simply decoration and should not be interpreted by a host to ensure portability across different implementors (e.g., Kafka -> NATS, etc.).

source

fn add_metadata<'life0, 'async_trait>( &'life0 mut self, key: String, value: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Add a new key-value pair to the metadata, overwriting any existing value for the same key

source

fn set_metadata<'life0, 'async_trait>( &'life0 mut self, meta: Metadata, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set the metadata

source

fn remove_metadata<'life0, 'async_trait>( &'life0 mut self, key: String, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Remove a key-value pair from the metadata

source

fn as_any(&self) -> &dyn Any

Return Self as Any

source

fn into_any(self: Box<Self>) -> Box<dyn Any>

Return Self as Any

Implementors§