Static
createConnects a worker to the mesh.
import { MeshFlow } from '@hotmeshio/hotmesh';
import { Client as Postgres } from 'pg';
import * as workflows from './workflows';
async function run() {
const worker = await MeshFlow.Worker.create({
connection: {
class: Postgres,
options: {
connectionString: 'postgres://user:password@localhost:5432/db'
},
},
taskQueue: 'default',
workflow: workflows.example,
});
await worker.run();
}
Static
hash
The Worker service Registers worker functions and connects them to the mesh, using the target backend provider/s (Redis, Postgres, NATS, etc).
Example