@totalsoft/correlation
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

correlation

This package provides core correlation functionality. The correlation manager allows opening a correlation scope that is propagated across async/await calls.

Installation

npm i @totalsoft/correlation

or

yarn add @totalsoft/correlation

Usage

import { correlationManager } from '@totalsoft/correlation'

// Open a correlation scope and set a correlation id. Set the correlation id to null to use an auto-generated one.
correlationManager.useCorrelationId('b48f6511-2f45-46c8-b9a5-655856712f32', async () => {
    await inner()
})

// function that uses the correlation id from the context
async function inner() {
    const correlationId = correlationManager.getCorrelationId()
}

Readme

Keywords

Package Sidebar

Install

npm i @totalsoft/correlation

Weekly Downloads

287

Version

1.1.0

License

MIT

Unpacked Size

30.9 kB

Total Files

12

Last publish

Collaborators

  • osstotalsoft