Overview
Functions are the core building blocks of III applications. A function is a piece of code that can be invoked remotely by other workers or triggers.Registering Functions
register_function
Register a function with the default configuration.impl Into<String>
required
Unique identifier for the function
F
required
Async function that processes input and returns a result. The handler receives a
serde_json::Value and must return Result<Value, IIIError>.register_function_with_description
Register a function with a description.impl Into<String>
required
Unique identifier for the function
impl Into<String>
required
Human-readable description of what the function does
F
required
Async function handler
register_function_with
Register a function with full configuration options.RegisterFunctionMessage
required
Complete function registration message with all metadata
F
required
Async function handler
HTTP Functions
HTTP functions are proxy functions that invoke external HTTP endpoints.register_http_function
Register a function that proxies to an HTTP endpoint.impl Into<String>
required
Unique identifier for the function
HttpInvocationConfig
required
HTTP configuration including URL, method, headers, and authentication
Result<HttpFunctionRef, IIIError>
Reference that can be used to unregister the function
Function Context
Every function handler runs within a context that provides logging and tracing capabilities.Accessing Context
Useget_context() to access the current function’s context:
Context Structure
TheContext struct provides:
logger: Logger instance scoped to the current functionspan: Active tracing span (whenotelfeature is enabled)
Function Discovery
list_functions
List all registered functions in the engine.Result<Vec<FunctionInfo>, IIIError>
List of all registered functions with their metadata
on_functions_available
Subscribe to notifications when functions become available.F
required
Callback invoked whenever functions are registered or updated
FunctionsAvailableGuard
Guard that automatically unsubscribes when dropped
Types
RegisterFunctionMessage
HttpInvocationConfig
HttpMethod
FunctionInfo
See Also
- Invocation API - Call registered functions
- Context API - Access function context and logging
- Triggers API - Automatically invoke functions based on events