Skip to main content

process_message

Function process_message 

Source
pub fn process_message(workflows_json: &str, payload_json: &str) -> Promise
Expand description

Process a payload through a one-off engine (convenience function).

Creates an engine with the given workflows and processes a single payload. Use WasmEngine class for better performance when processing multiple payloads.

§Arguments

  • workflows_json - JSON string containing an array of workflow definitions
  • payload_json - JSON string of the payload to process

§Returns

A Promise that resolves to the processed message as a JSON string

§Example

const payload = JSON.stringify({ name: "John", email: "john@example.com" });
const result = await process_message(workflowsJson, payload);
console.log(JSON.parse(result));