Skip to main content

Overview

The invocation API allows you to call functions registered by other workers. All invocation methods automatically propagate trace context when the otel 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
Example:

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::Value
Duration
required
Maximum time to wait for a response
Result<Value, IIIError>
The function’s return value, or IIIError::Timeout if the timeout is exceeded
Example:

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

Legacy Aliases

The SDK also provides trigger, trigger_with_timeout, and trigger_void methods that are aliases for the call methods:
These are functionally identical to 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 the otel feature is enabled, trace context is automatically propagated with function calls:
The SDK automatically:
  • Injects W3C traceparent and baggage headers 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

Or use the convenience method:

List Workers

Or use the convenience method:

Register Worker Metadata

Worker metadata is automatically registered when you call connect(), so you typically don’t need to call this manually.

Create Channel

Or use the convenience method:

Typed Invocations

For type-safe function calls, define request and response types:

See Also