pub fn process_message(workflows_json: &str, payload: &str) -> PromiseExpand 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. The payload is stored as a raw string and should be parsed by a parse plugin.
§Arguments
workflows_json- JSON string containing an array of workflow definitionspayload- Raw string payload to process (not parsed by the engine)
§Returns
A Promise that resolves to the processed message as a JSON string
§Example
const payload = '{"name": "John", "email": "john@example.com"}';
const result = await process_message(workflowsJson, payload);
console.log(JSON.parse(result));