Skip to main content

StreamingEngine

Struct StreamingEngine 

Source
pub struct StreamingEngine { /* private fields */ }
Expand description

The main streaming engine for pub/sub and CDC.

Implementations§

Source§

impl StreamingEngine

Source

pub fn new() -> Self

Create a new streaming engine.

Source

pub fn with_config(config: EngineConfig) -> Self

Create an engine with custom configuration.

Source

pub fn create_channel( &self, id: impl Into<ChannelId>, ) -> Result<(), EngineError>

Create a new channel.

Source

pub fn create_channel_with_config( &self, id: impl Into<ChannelId>, config: ChannelConfig, ) -> Result<(), EngineError>

Create a channel with custom configuration.

Source

pub fn delete_channel(&self, id: &ChannelId) -> Result<(), EngineError>

Delete a channel.

Source

pub fn list_channels(&self) -> Vec<ChannelId>

List all channels.

Source

pub fn channel_exists(&self, id: &ChannelId) -> bool

Check if a channel exists.

Source

pub fn publish( &self, channel_id: &ChannelId, event: Event, ) -> Result<usize, EngineError>

Publish an event to a channel.

Source

pub fn publish_change( &self, channel_id: &ChannelId, change: ChangeEvent, ) -> Result<usize, EngineError>

Publish a CDC change event.

Source

pub fn publish_to_many( &self, channel_ids: &[ChannelId], event: Event, ) -> HashMap<ChannelId, Result<usize, EngineError>>

Publish to multiple channels.

Source

pub fn subscribe( &self, channel_id: &ChannelId, subscriber_id: impl Into<SubscriberId>, ) -> Result<ChannelReceiver, EngineError>

Subscribe to a channel.

Source

pub fn subscribe_with_filter( &self, channel_id: &ChannelId, subscriber_id: impl Into<SubscriberId>, filter: EventFilter, ) -> Result<ChannelReceiver, EngineError>

Subscribe with a filter.

Source

pub fn unsubscribe(&self, channel_id: &ChannelId, subscriber_id: &SubscriberId)

Unsubscribe from a channel.

Source

pub fn get_subscriber(&self, id: &SubscriberId) -> Option<Subscriber>

Get a subscriber.

Source

pub fn list_subscribers(&self) -> Vec<SubscriberId>

List all subscribers.

Source

pub fn remove_subscriber(&self, id: &SubscriberId)

Remove a subscriber.

Source

pub fn create_consumer_group( &self, group_id: impl Into<String>, ) -> Result<(), EngineError>

Create a new consumer group with the given ID.

Source

pub fn delete_consumer_group(&self, group_id: &str) -> Result<(), EngineError>

Delete a consumer group.

Source

pub fn join_consumer_group( &self, group_id: &str, subscriber_id: SubscriberId, channels: HashSet<String>, ) -> Result<(), EngineError>

Join a consumer group. The subscriber is added as a member with the given set of assigned channels.

Source

pub fn leave_consumer_group( &self, group_id: &str, subscriber_id: &SubscriberId, ) -> Result<HashSet<String>, EngineError>

Leave a consumer group. Returns the channels that were assigned to the subscriber, or an error if the group or member was not found.

Source

pub fn commit_offset( &self, group_id: &str, channel_name: impl Into<String>, offset: u64, ) -> Result<(), EngineError>

Commit an offset for a channel within a consumer group.

Source

pub fn get_committed_offset( &self, group_id: &str, channel_name: &str, ) -> Result<Option<u64>, EngineError>

Get the committed offset for a channel within a consumer group.

Source

pub fn list_consumer_groups(&self) -> Vec<String>

List all consumer groups.

Source

pub fn get_consumer_group(&self, group_id: &str) -> Option<ConsumerGroup>

Get a snapshot of a consumer group.

Source

pub fn get_history( &self, channel_id: &ChannelId, count: usize, ) -> Result<Vec<Event>, EngineError>

Get recent events from a channel.

Source

pub fn get_history_after( &self, channel_id: &ChannelId, timestamp: u64, ) -> Result<Vec<Event>, EngineError>

Get events after a timestamp.

Source

pub fn stats(&self) -> EngineStats

Get engine statistics.

Source

pub fn reset_stats(&self)

Reset statistics.

Source

pub fn channel_stats(&self, id: &ChannelId) -> Option<ChannelStats>

Get channel statistics.

Trait Implementations§

Source§

impl Default for StreamingEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.