Package Exports
- @temporalio/worker
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@temporalio/worker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Worker library for temporal.io
Main package of the Temporal SDK. Used to run workflows and activities.
See the root README for more details.
Usage
import { Worker } from '@temporalio/worker';
async function run() => {
// Automatically locate and register activities and workflows
// (assuming package was bootstrapped with `npm init @temporalio`).
// Worker connects to localhost by default and uses console error for logging.
// Customize the worker by passing options a second parameter to the constructor.
const worker = await Worker.create(__dirname);
// Bind to the `tutorial` queue and start accepting tasks
await worker.run('tutorial');
}
run().catch((err) => {
console.error('Error while running worker', err);
process.exit(1);
});