Overview
The invocation API allows you to call functions registered by other workers. All invocation methods automatically propagate trace context when theotel feature is enabled.
Calling Functions
call
Call a function and wait for the result (with default 30-second timeout).&str
required
ID of the function to call
impl serde::Serialize
required
Input data to pass to the function (will be serialized to JSON)
Result<Value, IIIError>
The function’s return value, or an error if the call fails or times out
call_with_timeout
Call a function with a custom timeout.&str
required
ID of the function to call
Value
required
Input data as a
serde_json::ValueDuration
required
Maximum time to wait for a response
Result<Value, IIIError>
The function’s return value, or
IIIError::Timeout if the timeout is exceededcall_void
Call a function without waiting for a response (fire-and-forget).&str
required
ID of the function to call
TInput
required
Input data to pass to the function
Result<(), IIIError>
Returns immediately after sending the invocation (does not wait for result)
Legacy Aliases
The SDK also providestrigger, trigger_with_timeout, and trigger_void methods that are aliases for the call methods:
call, call_with_timeout, and call_void.
Error Handling
Error Types
Function calls can fail with these errors:Handling Errors
Example:Trace Context Propagation
When theotel feature is enabled, trace context is automatically propagated with function calls:
- Injects W3C
traceparentandbaggageheaders into outbound calls - Extracts these headers from inbound invocations
- Creates parent-child span relationships across function boundaries
Calling Engine Functions
The III Engine provides built-in functions:List Functions
List Workers
Register Worker Metadata
Worker metadata is automatically registered when you call
connect(), so you typically don’t need to call this manually.Create Channel
Typed Invocations
For type-safe function calls, define request and response types:See Also
- Functions API - Register functions that can be called
- Telemetry API - Configure distributed tracing
- Context API - Access context within function handlers