Overview
Triggers enable event-driven function invocations. When a trigger’s condition is met, it automatically invokes the associated function. The III SDK supports both registering triggers and implementing custom trigger types.Registering Triggers
register_trigger
Register a trigger that will invoke a function based on events.impl Into<String>
required
Type of trigger (e.g., “http”, “cron”, “stream”)
impl Into<String>
required
ID of the function to invoke when triggered
impl serde::Serialize
required
Configuration specific to the trigger type (serialized to JSON)
Result<Trigger, IIIError>
Trigger handle that can be used to unregister
Unregistering Triggers
Triggers are automatically unregistered when theTrigger handle is dropped, or you can manually unregister:
Listing Triggers
list_triggers
List all registered triggers in the engine.Result<Vec<TriggerInfo>, IIIError>
List of all registered triggers
Implementing Custom Trigger Types
TriggerHandler Trait
Implement custom trigger types by implementing theTriggerHandler trait.
register_trigger_type
Register a custom trigger type handler.impl Into<String>
required
Unique identifier for this trigger type
impl Into<String>
required
Human-readable description of the trigger type
H
required
Implementation of TriggerHandler that manages triggers of this type
unregister_trigger_type
Unregister a trigger type.impl Into<String>
required
ID of the trigger type to unregister
Types
Trigger
Handle to a registered trigger.TriggerConfig
Configuration passed to trigger handlers.TriggerInfo
Information about a registered trigger.Built-in Trigger Types
The III Engine provides these built-in trigger types:HTTP Trigger
Invokes a function when an HTTP request is received.path: HTTP path (e.g.,/webhook)method: HTTP method (GET,POST,PUT,DELETE,PATCH)
Cron Trigger
Invokes a function on a schedule.schedule: Cron expression (standard crontab format)
Stream Trigger
Invokes a function when stream data is updated.stream: Stream namegroup: Optional group ID filter
Functions Available Trigger
Special trigger that fires when functions are registered/updated.For convenience, use
iii.on_functions_available() instead of registering this trigger directly.See Also
- Functions API - Register functions that triggers invoke
- Invocation API - Manually invoke functions
- Context API - Access context within triggered functions