Workflow client. Starts workflows, sends signals, and reads results.

import { Durable } from '@hotmeshio/hotmesh';
import { Client as Postgres } from 'pg';

const client = new Durable.Client({
connection: {
class: Postgres,
options: { connectionString: 'postgresql://usr:pwd@localhost:5432/db' },
},
});

// Start a workflow and await its result
const handle = await client.workflow.start({
args: ['order-123'],
taskQueue: 'orders',
workflowName: 'orderWorkflow',
workflowId: Durable.guid(),
});
const result = await handle.result();

// Send a signal to a running workflow
await handle.signal('approval', { approved: true });

// Cancel a running workflow
await handle.cancel();

Properties

workflow: ClientWorkflow = ...

The Durable Client service provides methods for starting, signaling, and querying workflows. Starting a workflow is the primary use case and is accessed by calling workflow.start().

Methods

  • Any router can be used to deploy and activate the HotMesh distributed executable to the active quorum EXCEPT for those routers in readonly mode.

    Parameters

    • namespace: string = APP_ID
    • version: string = APP_VERSION

    Returns Promise<void>