Trait hedwig::publish::Publisher [−][src]
pub trait Publisher {
type MessageId: 'static;
type MessageError: Error + Send + Sync + 'static;
type PublishStream: Stream<Item = Result<Self::MessageId, Self::MessageError>>;
fn publish<'a, I>(&self, topic: Topic, messages: I) -> Self::PublishStream
where
I: Iterator<Item = &'a ValidatedMessage> + DoubleEndedIterator + ExactSizeIterator;
}
This is supported on crate feature
publish
only.Expand description
Message publishers.
Message publishers deliver a validated message to an endpoint, possibly a remote one. Message publishers may also additionally validate a message for publisher-specific requirements (e.g. size).
Associated Types
type MessageError: Error + Send + Sync + 'static
type MessageError: Error + Send + Sync + 'static
The error that this publisher returns when publishing of a message fails.
type PublishStream: Stream<Item = Result<Self::MessageId, Self::MessageError>>
type PublishStream: Stream<Item = Result<Self::MessageId, Self::MessageError>>
The stream of results that the publish
method returns.
Required methods
fn publish<'a, I>(&self, topic: Topic, messages: I) -> Self::PublishStream where
I: Iterator<Item = &'a ValidatedMessage> + DoubleEndedIterator + ExactSizeIterator,
fn publish<'a, I>(&self, topic: Topic, messages: I) -> Self::PublishStream where
I: Iterator<Item = &'a ValidatedMessage> + DoubleEndedIterator + ExactSizeIterator,
Publish a batch of messages.
The output stream shall return a result for each message in messages
slice in order.