Expand description
Tana Event Bus - Rust Client Library
This library provides a simple interface for dispatching events to the Tana Event Bus server.
§Examples
use tana_event_bus::{dispatch_event, Event, EventLevel, configure};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Optional: Configure once at app startup
configure(Some("http://events.tana.network:8508"), None, None)?;
// Dispatch an event
dispatch_event(Event {
service: "edge".to_string(),
level: EventLevel::Info,
category: "contract_execution".to_string(),
message: "Contract executed successfully".to_string(),
timestamp: None, // Will be set automatically
metadata: Some(json!({
"contract_id": "abc123",
"duration_ms": 45
})),
}).await?;
Ok(())
}Structs§
- Config
- Client configuration
- Event
- Core event structure
- Event
Response - Response from the event bus server
Enums§
- Event
Level - Event log levels
Functions§
- configure
- Configure the event bus client
- dispatch_
event - Dispatch an event to the event bus server
- dispatch_
event_ async - Fire-and-forget event dispatch (spawns a tokio task, does not wait for response)
- get_
config - Get current configuration