getCorrelationId
getCorrelationId():
string
Defined in: correlation.store.ts:101
Read the current correlation ID.
It is the correlation id set by runWithCorrelationId, the HTTP middleware, or a running pipeline. Outside any, a new UUIDv7 is generated on each call, so it always returns a string.
Returns
Section titled “Returns”string
Example
Section titled “Example”import { getCorrelationId } from '@cqrs-ddd/pipeline-correlation';
class EmailWorker { @WithCorrelation() async process(job: Job) { console.log(`Processing with correlation: ${getCorrelationId()}`); await sendEmail(job.data); }}