celp_sdk/broker/
interface.rsuse std::result::Result;
use crate::protobuf::system_event::Severity;
pub struct Message {
pub data: Vec<u8>,
pub topic: String,
}
pub trait Publish {
type Error;
fn publish<M: prost::Message>(&mut self, topic: &str, message: &M) -> Result<(), Self::Error>;
fn publish_with_cache<M: prost::Message>(
&mut self,
topic: &str,
message: &M,
) -> Result<(), Self::Error>;
fn publish_event<E: prost::Message + prost::Name>(
&mut self,
event_details: &E,
severity: Severity,
) -> Result<(), Self::Error>;
fn publish_raw(&mut self, topic: &str, data: &[u8]) -> Result<(), Self::Error>;
}
pub trait Subscribe {
type Error;
fn subscribe(&mut self, topic: &str) -> Result<Option<Message>, Self::Error>;
fn subscribe_pattern(&mut self, pattern: &str) -> Result<(), Self::Error>;
fn subscribe_event<E: prost::Message + prost::Name>(
&mut self,
) -> Result<Option<Message>, Self::Error>;
fn unsubscribe(&mut self, topic: &str) -> Result<(), Self::Error>;
fn unsubscribe_pattern(&mut self, pattern: &str) -> Result<(), Self::Error>;
fn unsubscribe_event<E: prost::Message + prost::Name>(&mut self) -> Result<(), Self::Error>;
fn get_message(&mut self) -> Result<Message, Self::Error>;
}