Runtime Suppport

Obelisk provides built-in runtime support functions that can be accessed by workflows. These functions offer essential capabilities like logging, random number generation, creating join sets, and, crucially, the ability to pause workflow execution (sleep). Activities and webhook endpoints have access to logging support functions, but not to the other workflow-specific functions.

Available Support Functions

The runtime support functions are defined using WIT (WebAssembly Interface Type) files. Here's a breakdown of the available functions, grouped by their WIT interface:

obelisk:log@1.0.0 (Logging)

This interface provides standard logging functions, available to workflows, activities, and webhook endpoints. All messages are strings.

Example (Rust):

use obelisk::log::log;

log::info("This is an informational message.");
log::error("This is an error message!");

obelisk:workflow@1.0.0 (Workflow-Specific Support)

This interface provides functions that are only available to workflows.

Example (Rust):

use obelisk::workflow::workflow_support::*;
use obelisk::types::time::Duration;

// Persistently sleep for 5 seconds
sleep(Duration::Seconds(5));

// Generate a random number between 1 and 10 (inclusive)
let random_num = random_u64_inclusive(1, 10);

// Create a named join set
let join_set_id = new_join_set_named("my_join_set", ClosingStrategy::Complete);