pub struct MessageChannel { /* private fields */ }
flume
only.Expand description
Message channel for sending and receiving cloud events.
Implementations§
Source§impl MessageChannel
impl MessageChannel
Sourcepub fn with_subscription(sub: Subscription) -> Self
pub fn with_subscription(sub: Subscription) -> Self
Creates a new instance with the subscription.
Returns a reference to the shared message channel.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Get the number of subscribers that currently exist.
Sourcepub fn try_send(
&self,
message: impl Into<CloudEvent>,
) -> Result<(), TrySendError<CloudEvent>>
pub fn try_send( &self, message: impl Into<CloudEvent>, ) -> Result<(), TrySendError<CloudEvent>>
Attempts to send a message to all receivers in the channel except this one. If the channel is full or all receivers have been dropped, an error is returned.
Sourcepub async fn send(
&self,
message: impl Into<CloudEvent>,
) -> Result<(), SendError<CloudEvent>>
pub async fn send( &self, message: impl Into<CloudEvent>, ) -> Result<(), SendError<CloudEvent>>
Asynchronously sends a message to all receivers in the channel except this one, returning an error if all receivers have been dropped. If the channel is full, it will yield to the async runtime.
Sourcepub fn sink(&self) -> impl Sink<CloudEvent>
pub fn sink(&self) -> impl Sink<CloudEvent>
Returns a sink that allows asynchronously sending messages into the channel.
Sourcepub fn stream(&self) -> impl Stream<Item = CloudEvent> + '_
pub fn stream(&self) -> impl Stream<Item = CloudEvent> + '_
Returns a stream that allows asynchronously receiving messages from the channel.
Sourcepub fn into_stream(self) -> impl Stream<Item = CloudEvent>
pub fn into_stream(self) -> impl Stream<Item = CloudEvent>
Converts self
into a stream that allows asynchronously receiving messages from the channel.
Trait Implementations§
Source§impl Clone for MessageChannel
impl Clone for MessageChannel
Source§fn clone(&self) -> MessageChannel
fn clone(&self) -> MessageChannel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more