pub struct PgEventListener<E, S>{ /* private fields */ }Expand description
PostgreSQL event listener implementation.
Implementations§
Source§impl<E, S> PgEventListener<E, S>
impl<E, S> PgEventListener<E, S>
Sourcepub fn builder(event_store: PgEventStore<E, S>) -> Self
pub fn builder(event_store: PgEventStore<E, S>) -> Self
Sourcepub fn uninitialized(self) -> Self
pub fn uninitialized(self) -> Self
Marks the event listener as uninitialized, indicating that the database setup is already done.
This method sets the initialize flag to false. When the flag is unset, the listener will not
initialize the database. If you set initialize to false, you must ensure that the
database is initialized before running the listener. Check the SQL files in the listener/sql folder
to initialize the database.
§Returns
The updated PgEventListener instance with the uninitialized flag set.
Sourcepub fn register_listener<QE>(
self,
event_listener: impl EventListener<PgEventId, QE> + 'static,
config: PgEventListenerConfig,
) -> Self
pub fn register_listener<QE>( self, event_listener: impl EventListener<PgEventId, QE> + 'static, config: PgEventListenerConfig, ) -> Self
Registers an event listener to the PgEventListener.
§Parameters
event_listner: An implementation of theEventListenertrait for the specified event typeQE.config: APgEventListenerConfiginstance representing the configuration for the event listener.
§Returns
The updated PgEventListener instance with the registered event handler.
Sourcepub async fn start(self) -> Result<(), Error>
pub async fn start(self) -> Result<(), Error>
Starts the listener process for all registered event listeners.
§Returns
A Result indicating the success or failure of the listener process.
Auto Trait Implementations§
impl<E, S> Freeze for PgEventListener<E, S>where
S: Freeze,
impl<E, S> !RefUnwindSafe for PgEventListener<E, S>
impl<E, S> Send for PgEventListener<E, S>where
E: Send,
impl<E, S> Sync for PgEventListener<E, S>where
E: Sync,
impl<E, S> Unpin for PgEventListener<E, S>
impl<E, S> !UnwindSafe for PgEventListener<E, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more