Skip to main content

LocalEventBusFactory

Struct LocalEventBusFactory 

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

Factory used to create LocalEventBus instances with default options.

Implementations§

Source§

impl LocalEventBusFactory

Source

pub fn new() -> Self

Creates an empty local event bus factory.

§Returns

Factory with no typed defaults.

Source

pub fn set_default_publish_options<T>(&mut self, options: PublishOptions<T>)
where T: Send + Sync + 'static,

Sets default publish options for a payload type.

§Parameters
  • options: Options used by default publish methods for payload T.
Source

pub fn set_default_subscribe_options<T>(&mut self, options: SubscribeOptions<T>)
where T: Send + Sync + 'static,

Sets default subscribe options for a payload type.

§Parameters
Source

pub fn set_default_dead_letter_strategy<T, F>(&mut self, strategy: F)
where T: Clone + Send + Sync + 'static, F: DeadLetterStrategyCallback<T>,

Sets the default dead-letter strategy for a payload type.

§Parameters
  • strategy: Strategy used when subscription options do not provide one.
Source

pub fn set_global_default_dead_letter_strategy<F>(&mut self, strategy: F)

Sets the global default dead-letter strategy.

§Parameters
  • strategy: Strategy used when no subscription or typed factory dead-letter strategy is configured.
Source

pub fn add_publisher_interceptor<T, I>( &mut self, interceptor: I, ) -> EventBusResult<()>
where T: Clone + Send + Sync + 'static, I: PublisherInterceptor<T>,

Adds a publisher interceptor to buses created by this factory.

§Parameters
  • interceptor: Callback that can modify or drop outgoing envelopes.
§Returns

Ok(()) when the interceptor is stored.

Source

pub fn add_global_publisher_interceptor<I>( &mut self, interceptor: I, ) -> EventBusResult<()>

Adds a global publisher interceptor to buses created by this factory.

§Parameters
  • interceptor: Callback that can mutate metadata or drop any event.
§Returns

Ok(()) when the interceptor is stored.

Source

pub fn add_subscriber_interceptor<T, I>( &mut self, interceptor: I, ) -> EventBusResult<()>
where T: Clone + Send + Sync + 'static, I: SubscriberInterceptor<T>,

Adds a subscriber interceptor to buses created by this factory.

§Parameters
  • interceptor: Callback wrapping subscriber handler execution.
§Returns

Ok(()) when the interceptor is stored.

Source

pub fn add_global_subscriber_interceptor<I>( &mut self, interceptor: I, ) -> EventBusResult<()>

Adds a global subscriber interceptor to buses created by this factory.

§Parameters
  • interceptor: Callback wrapping subscriber handling for any payload type.
§Returns

Ok(()) when the interceptor is stored.

Source

pub fn set_subscription_handler_pool_size( &mut self, pool_size: usize, ) -> EventBusResult<()>

Sets the subscription handler worker count for created buses.

§Parameters
  • pool_size: Number of worker threads used for subscriber handlers.
§Returns

Ok(()) when the value is stored.

§Errors

Returns EventBusError::InvalidArgument when pool_size is zero.

Source

pub fn set_subscription_handler_queue_capacity( &mut self, capacity: Option<usize>, ) -> EventBusResult<()>

Sets the optional subscription handler queue capacity.

§Parameters
  • capacity: Maximum queued subscriber tasks, or None for unbounded.
§Returns

Ok(()) when the value is stored.

§Errors

Returns EventBusError::InvalidArgument when a configured capacity is zero.

Source

pub fn create(&self) -> LocalEventBus

Creates a stopped event bus.

§Returns

Local event bus initialized with factory defaults.

Source

pub fn create_started(&self) -> EventBusResult<LocalEventBus>

Creates and starts an event bus.

§Returns

Started local event bus initialized with factory defaults.

§Errors

Returns startup errors from the handler executor.

Trait Implementations§

Source§

impl Default for LocalEventBusFactory

Source§

fn default() -> Self

Creates an empty local event bus factory with default runtime options.

Source§

impl EventBusFactory for LocalEventBusFactory

Source§

fn is_transactional_supported(&self) -> bool

Local event bus does not support transactional operations.

Source§

fn create(&self) -> Self::Bus

Creates a stopped local event bus.

Source§

fn create_started(&self) -> EventBusResult<Self::Bus>

Creates and starts a local event bus.

Source§

fn set_default_publish_options<T>( &mut self, options: PublishOptions<T>, ) -> EventBusResult<()>
where T: Send + Sync + 'static,

Sets typed default publish options for local buses.

Source§

fn set_default_subscribe_options<T>( &mut self, options: SubscribeOptions<T>, ) -> EventBusResult<()>
where T: Send + Sync + 'static,

Sets typed default subscribe options for local buses.

Source§

fn set_default_dead_letter_strategy<T, F>( &mut self, strategy: F, ) -> EventBusResult<()>
where T: Clone + Send + Sync + 'static, F: DeadLetterStrategyCallback<T>,

Sets a typed default dead-letter strategy for local buses.

Source§

fn set_global_default_dead_letter_strategy<F>( &mut self, strategy: F, ) -> EventBusResult<()>

Sets the global default dead-letter strategy for local buses.

Source§

fn add_publisher_interceptor<T, I>( &mut self, interceptor: I, ) -> EventBusResult<()>
where T: Clone + Send + Sync + 'static, I: PublisherInterceptor<T>,

Adds a typed publisher interceptor for local buses.

Source§

fn add_global_publisher_interceptor<I>( &mut self, interceptor: I, ) -> EventBusResult<()>

Adds a global publisher interceptor for local buses.

Source§

fn add_subscriber_interceptor<T, I>( &mut self, interceptor: I, ) -> EventBusResult<()>
where T: Clone + Send + Sync + 'static, I: SubscriberInterceptor<T>,

Adds a typed subscriber interceptor for local buses.

Source§

fn add_global_subscriber_interceptor<I>( &mut self, interceptor: I, ) -> EventBusResult<()>

Adds a global subscriber interceptor for local buses.

Source§

type Bus = LocalEventBus

Concrete event bus created by this factory.
Source§

type TransactionalBus = UnsupportedTransactionalEventBus

Transactional event bus type returned when the backend supports it.
Source§

fn create_transactional(&self) -> EventBusResult<Self::TransactionalBus>

Creates a transactional event bus. 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> IntoResult<T> for T

Source§

impl<T> IntoValueDefault<T> for T

Source§

fn into_value_default(self) -> T

Converts this argument into the default value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.