Skip to main content

EventProcessor

Trait EventProcessor 

Source
pub trait EventProcessor: Send + Sync {
    // Required methods
    fn send(&self, event: InputEvent);
    fn flush(&self);
    fn close(&self);
    fn flush_blocking(&self, timeout: Duration) -> bool;
}
Expand description

Trait for the component that buffers analytics events and sends them to LaunchDarkly. This component can be replaced for testing purposes.

Required Methods§

Source

fn send(&self, event: InputEvent)

Records an InputEvent asynchronously. Depending on the feature flag properties and event properties, this may be transmitted to the events service as an individual event, or may only be added into summary data.

Source

fn flush(&self)

Specifies that any buffered events should be sent as soon as possible, rather than waiting for the next flush interval. This method is asynchronous, so events still may not be sent until a later time.

Source

fn close(&self)

Shuts down all event processor activity, after first ensuring that all events have been delivered. Subsequent calls to EventProcessor::send or EventProcessor::flush will be ignored.

Source

fn flush_blocking(&self, timeout: Duration) -> bool

Tells the event processor that all pending analytics events should be delivered as soon as possible, and blocks until delivery is complete or the timeout expires.

This method triggers a flush of events currently in the outbox and waits for that specific flush to complete. Note that if periodic flushes or other flush operations are in-flight when this is called, those may still be completing after this method returns.

§Arguments
  • timeout - Maximum time to wait for flush to complete. Use Duration::ZERO to wait indefinitely.
§Returns

Returns true if flush completed successfully, false if timeout occurred or the event processor has been shut down.

Implementors§