Skip to main content

Target

Trait Target 

Source
pub trait Target<E>:
    Send
    + Sync
    + 'static
where E: PluginEvent,
{
Show 16 methods // Required methods fn id(&self) -> TargetID; fn is_active<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn save<'life0, 'async_trait>( &'life0 self, event: Arc<EntityTarget<E>>, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn send_raw_from_store<'life0, 'async_trait>( &'life0 self, key: Key, body: Vec<u8>, meta: QueuedPayloadMeta, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn store( &self, ) -> Option<&(dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send + Sync)>; fn clone_dyn(&self) -> Box<dyn Target<E> + Send + Sync>; fn is_enabled(&self) -> bool; // Provided methods fn name(&self) -> String { ... } fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TargetHealth> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn send_from_store<'life0, 'async_trait>( &'life0 self, key: Key, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn failed_store(&self) -> Option<&dyn FailedEventStore> { ... } fn handle_terminal_failure<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _store: &'life1 (dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send), _key: &'life2 Key, _error: &'life3 TargetError, _retry_count: u32, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn delivery_snapshot(&self) -> TargetDeliverySnapshot { ... } fn record_final_failure(&self) { ... }
}
Expand description

Trait for notification targets

Required Methods§

Source

fn id(&self) -> TargetID

Returns the ID of the target

Source

fn is_active<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks if the target is active and reachable

Source

fn save<'life0, 'async_trait>( &'life0 self, event: Arc<EntityTarget<E>>, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Saves an event (either sends it immediately or stores it for later).

A target whose Self::store returns Some must only persist the event here; network delivery belongs to its replay worker. Runtime lifecycle handoff drains these durable enqueues while allowing a direct network send to finish against a detached target.

Source

fn send_raw_from_store<'life0, 'async_trait>( &'life0 self, key: Key, body: Vec<u8>, meta: QueuedPayloadMeta, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends an event from the store using the queued raw body and metadata.

Source

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Closes the target and releases resources

Source

fn store( &self, ) -> Option<&(dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send + Sync)>

Returns the store associated with the target (if any)

Source

fn clone_dyn(&self) -> Box<dyn Target<E> + Send + Sync>

Returns the type of the target

Source

fn is_enabled(&self) -> bool

Check if the target is enabled

Provided Methods§

Source

fn name(&self) -> String

Returns the name of the target

Source

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = TargetHealth> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a credential-free, machine-readable health result.

Source

fn send_from_store<'life0, 'async_trait>( &'life0 self, key: Key, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends an event from the store.

Source

fn failed_store(&self) -> Option<&dyn FailedEventStore>

Returns the failed-events store capability when the target records terminal failures.

The default is no capability, so a target that never parks a terminal entry runs no failed-store maintenance and reports zero failed-store depth.

Source

fn handle_terminal_failure<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _store: &'life1 (dyn Store<QueuedPayload, Error = StoreError, Key = Key> + Send), _key: &'life2 Key, _error: &'life3 TargetError, _retry_count: u32, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Moves a terminally failed entry to the target’s failed-events store, returning true when the entry was handled. A target without a terminal-failure store declines the move and the entry stays live.

Source

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), TargetError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the target, such as establishing a connection, etc.

Source

fn delivery_snapshot(&self) -> TargetDeliverySnapshot

Returns a read-only delivery snapshot for metrics collection.

Source

fn record_final_failure(&self)

Records a final, non-retryable delivery failure for metrics collection.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E> Target<E> for AMQPTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for KafkaTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for MQTTTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for MySqlTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for NATSTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for PostgresTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for PulsarTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for RedisTarget<E>
where E: PluginEvent,

Source§

impl<E> Target<E> for WebhookTarget<E>
where E: PluginEvent,