mit einem Klick
iii-functions-and-triggers
// Registers functions and triggers on the iii engine across TypeScript, Python, and Rust. Use when creating workers, registering function handlers, binding triggers, or invoking functions across languages.
// Registers functions and triggers on the iii engine across TypeScript, Python, and Rust. Use when creating workers, registering function handlers, binding triggers, or invoking functions across languages.
Browser SDK for connecting to the iii engine from web applications via WebSocket. Use when building browser-based clients that register functions, invoke triggers, or consume streams from the frontend.
Binary streaming between workers via channels. Use when building data pipelines, file transfers, streaming responses, or any pattern requiring binary data transfer between functions.
Registers cron triggers with 7-field expressions to run functions on recurring schedules. Use when scheduling periodic jobs, timed automation, crontab replacements, cleanup routines, report generation, batch processing, or calendar-based work that is genuinely time-driven.
Builds custom trigger types for events iii does not handle natively. Use when integrating webhooks, file watchers, IoT devices, database CDC, or any external event source.
Configures the iii engine via iii-config.yaml — workers, adapters, queue configs, ports, and environment variables. Use when deploying, tuning, or customizing the engine.
Handle iii engine and SDK errors across Node, Python, Rust, and browser workers. Use when interpreting error codes, retryability, RBAC denial, timeouts, handler failures, or SDK-specific exception surfaces.
| name | iii-functions-and-triggers |
| description | Registers functions and triggers on the iii engine across TypeScript, Python, and Rust. Use when creating workers, registering function handlers, binding triggers, or invoking functions across languages. |
Comparable to: Serverless function runtimes, Lambda, Cloud Functions
Use the concepts below when they fit the task. Not every worker needs all of them.
trigger() regardless of language or worker locationHttpInvocationConfigschemars::JsonSchema) and Python (via type hints / Pydantic), or manually provided in Node.jsregisterWorker() connects the worker to the engine, registerFunction defines handlers, registerTrigger binds event sources to those handlers, and the engine routes incoming events to the correct function. Functions can invoke other functions across workers and languages via trigger().
| Primitive | Purpose |
|---|---|
registerWorker(url, options?) | Connect worker to engine |
registerFunction(id, handler, options?) | Define a local function handler |
registerFunction(id, HttpInvocationConfig, options?) | Define an HTTP-invoked function |
registerTrigger({ type, function_id, config, metadata? }) | Bind an event source to a function |
trigger({ function_id, payload }) | Invoke a function synchronously |
trigger({ ..., action: TriggerAction.Void() }) | Fire-and-forget invocation |
trigger({ ..., action: TriggerAction.Enqueue({ queue }) }) | Durable async invocation via queue |
Each reference shows the same patterns (function registration, trigger binding, cross-function invocation) in its respective language.
Code using this pattern commonly includes, when relevant:
registerWorker('ws://localhost:49134', { workerName: 'my-worker' }) — connect to the engineregisterFunction('namespace::name', async (input) => { ... }, { description, metadata }) — register a local handlerregisterFunction('legacy::charge', { url, method: 'POST', timeout_ms, headers, auth }) — register an HTTP-invoked external endpointregisterTrigger({ type: 'http', function_id, config: { api_path, http_method, middleware_function_ids? } }) — HTTP trigger (with optional middleware)registerTrigger({ type: 'durable:subscriber', function_id, config: { topic } }) — queue triggerregisterTrigger({ type: 'cron', function_id, config: { expression } }) — cron triggerregisterTrigger({ type: 'state', function_id, config: { scope, key } }) — state change triggerregisterTrigger({ type: 'stream', function_id, config: { stream_name, group_id, item_id } }) — stream item triggerregisterTrigger({ type: 'subscribe', function_id, config: { topic } }) — pubsub subscriberregisterTrigger({ ..., metadata: { owner: 'team', priority: 'high' } }) — optional trigger metadataFunctions can declare their input/output schemas for documentation and discovery:
schemars::JsonSchema on handler input/output types — RegisterFunction::new() auto-generates JSON Schema (Draft 7) from the typeregister_function() auto-extracts JSON Schema (Draft 2020-12)request_format / response_format manually in the registration message (e.g., via Zod's toJSONSchema())Use the adaptations below when they apply to the task.
namespace::name convention for function IDs to group related functionsapi_path and http_method in the trigger configHttpInvocationConfig; do not model it as an inbound HTTP triggerTriggerAction.Enqueue({ queue }) instead of synchronous triggerTriggerAction.Void()iii-http-endpoints.iii-queue-processing.iii-cron-scheduling.iii-trigger-actions.iii-http-invoked-functions.iii-trigger-schemas.iii-functions-and-triggers when the primary problem is registering functions, binding triggers, or cross-language invocation.iii-functions-and-triggers in the iii engine.