The Worker service Registers worker functions and connects them to the mesh, using the target backend provider/s (Redis, Postgres, NATS, etc).

import { MeshFlow } from '@hotmeshio/hotmesh';
import Redis from 'ioredis';
import * as workflows from './workflows';

async function run() {
const worker = await MeshFlow.Worker.create({
connection: {
class: Redis,
options: { host: 'redis', port: 6379 },
},
taskQueue: 'default',
workflow: workflows.example,
});

await worker.run();
}

Methods

Methods

  • Connects a worker to the mesh.

    Parameters

    Returns Promise<WorkerService>

    import { MeshFlow } from '@hotmeshio/hotmesh';
    import Redis from 'ioredis';
    import * as workflows from './workflows';

    async function run() {
    const worker = await MeshFlow.Worker.create({
    connection: {
    class: Redis,
    options: { host: 'redis', port: 6379 },
    },
    taskQueue: 'default',
    workflow: workflows.example,
    });

    await worker.run();
    }