send

Function send 

Source
pub fn send<T>(name: &str, data: T) -> Result<(), SdkError>
where T: Serialize,
Expand description

Sends an event queue entry to the system.

This function serializes the provided log data and sends it to the event queue system. The log data can be any type that implements serde::Serialize.

§Arguments

  • name - The name of the event to be logged. Used in event filtering.
  • data - The log data to be sent. Must implement serde::Serialize.

§Returns

Returns Ok(()) on success, or an SdkError if serialization fails.

§Example

use serde::Serialize;
use grafbase_sdk::host_io::event_queue;

#[derive(Serialize)]
struct UserAction<'a> {
    action: &'a str,
    user_id: &'a str,
}

let action = UserAction {
    action: "login",
    user_id: "user123"
};

event_queue::send("user_action", action)?;