Trait SubscriptionBackplane
pub trait SubscriptionBackplane:
Send
+ Sync
+ 'static {
// Required methods
fn publish<'a>(
&'a self,
channel: &'a str,
payload: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), CratestackError>> + Send + 'a>>;
fn subscribe<'a>(
&'a self,
channel: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = BackplaneMessage> + Send>>, CratestackError>> + Send + 'a>>;
// Provided method
fn publishes_model_events_in_tx(&self) -> bool { ... }
}Expand description
Fans a published message out to every replica, this one included.
Required Methods§
fn publish<'a>(
&'a self,
channel: &'a str,
payload: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), CratestackError>> + Send + 'a>>
fn publish<'a>( &'a self, channel: &'a str, payload: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), CratestackError>> + Send + 'a>>
Publishes payload on channel, fire and forget.
fn subscribe<'a>(
&'a self,
channel: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = BackplaneMessage> + Send>>, CratestackError>> + Send + 'a>>
fn subscribe<'a>( &'a self, channel: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = BackplaneMessage> + Send>>, CratestackError>> + Send + 'a>>
Receives everything published on channel from now on. The future
resolves only once the subscription is live, so a caller that then
tells its client “ready” has not missed anything published after.
Provided Methods§
fn publishes_model_events_in_tx(&self) -> bool
fn publishes_model_events_in_tx(&self) -> bool
Whether model events reach this backplane from inside the writing
transaction (Postgres NOTIFY, delivered at commit). When false, the
runtime publishes each model event after commit, from its outbox drain,
and a topic’s publish_in_tx is refused.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".