Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@temporalio/worker

Package Overview
Dependencies
Maintainers
7
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@temporalio/worker

Temporal.io SDK Worker sub-package

  • 1.11.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
150K
decreased by-26.99%
Maintainers
7
Weekly downloads
 
Created

What is @temporalio/worker?

@temporalio/worker is a Node.js package that allows you to create and manage Temporal workflows and activities. Temporal is a platform for orchestrating microservices and managing stateful workflows. The @temporalio/worker package provides the necessary tools to define, execute, and manage these workflows and activities in a Node.js environment.

What are @temporalio/worker's main functionalities?

Creating a Worker

This code sample demonstrates how to create a Temporal worker. The worker is configured with the path to the workflows and activities, and it listens on a specific task queue.

const { Worker } = require('@temporalio/worker');

async function run() {
  const worker = await Worker.create({
    workflowsPath: require.resolve('./workflows'),
    activities: require('./activities'),
    taskQueue: 'example',
  });
  await worker.run();
}

run().catch(err => console.error(err));

Defining a Workflow

This code sample shows how to define a workflow in Temporal. The workflow uses proxy activities to call the actual activity functions.

const { proxyActivities } = require('@temporalio/workflow');

const activities = proxyActivities({
  startToCloseTimeout: '1 minute',
});

async function exampleWorkflow() {
  await activities.someActivity();
}

module.exports = { exampleWorkflow };

Defining an Activity

This code sample demonstrates how to define an activity in Temporal. Activities are the building blocks of workflows and contain the actual business logic.

async function someActivity() {
  // Activity logic here
  console.log('Activity executed');
}

module.exports = { someActivity };

Other packages similar to @temporalio/worker

Keywords

FAQs

Package last updated on 17 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc