Skip to main content

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
Example - HTTP Trigger:
Example - Cron Trigger:
Example - Stream Trigger:

Unregistering Triggers

Triggers are automatically unregistered when the Trigger 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
Example:

Implementing Custom Trigger Types

TriggerHandler Trait

Implement custom trigger types by implementing the TriggerHandler trait.
Example - Custom Trigger Type:

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
Example:

unregister_trigger_type

Unregister a trigger type.
impl Into<String>
required
ID of the trigger type to unregister
Example:

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.
Config:
  • path: HTTP path (e.g., /webhook)
  • method: HTTP method (GET, POST, PUT, DELETE, PATCH)

Cron Trigger

Invokes a function on a schedule.
Config:
  • schedule: Cron expression (standard crontab format)

Stream Trigger

Invokes a function when stream data is updated.
Config:
  • stream: Stream name
  • group: 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