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

@temporalio/client

Package Overview
Dependencies
Maintainers
7
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@temporalio/client

Temporal.io SDK Client sub-package

  • 1.4.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
224K
decreased by-20.86%
Maintainers
7
Weekly downloads
 
Created

What is @temporalio/client?

@temporalio/client is an npm package that provides a client for interacting with Temporal, a platform for orchestrating microservices and managing workflows. It allows developers to start, query, and manage workflows and activities in a Temporal server.

What are @temporalio/client's main functionalities?

Starting a Workflow

This feature allows you to start a new workflow. The code sample demonstrates how to create a connection to the Temporal server, instantiate a WorkflowClient, and start a workflow with a specified task queue.

const { Connection, WorkflowClient } = require('@temporalio/client');

async function run() {
  const connection = new Connection();
  const client = new WorkflowClient(connection.service);
  const handle = await client.start('exampleWorkflow', { taskQueue: 'example' });
  console.log(`Started workflow with ID: ${handle.workflowId}`);
}

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

Querying a Workflow

This feature allows you to query the state of a running workflow. The code sample shows how to get a handle to a workflow using its ID and perform a query on it.

const { Connection, WorkflowClient } = require('@temporalio/client');

async function run() {
  const connection = new Connection();
  const client = new WorkflowClient(connection.service);
  const handle = client.getHandle('exampleWorkflowId');
  const result = await handle.query('exampleQuery');
  console.log(`Query result: ${result}`);
}

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

Cancelling a Workflow

This feature allows you to cancel a running workflow. The code sample demonstrates how to get a handle to a workflow using its ID and cancel it.

const { Connection, WorkflowClient } = require('@temporalio/client');

async function run() {
  const connection = new Connection();
  const client = new WorkflowClient(connection.service);
  const handle = client.getHandle('exampleWorkflowId');
  await handle.cancel();
  console.log('Workflow cancelled');
}

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

Other packages similar to @temporalio/client

Keywords

FAQs

Package last updated on 06 Oct 2022

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