addCorrelationId
addCorrelationId<
T>(data):WithCorrelationId<T>
Defined in: correlation.store.ts:173
Stamp the current correlation ID onto a data object.
This is the producer-side counterpart to WithCorrelation:
addCorrelationId(data)→ stamps the ID when enqueuing a job / publishing a message@WithCorrelation()→ extracts the ID when processing the job / handling the message
Both default to the 'correlationId' key, so they work together out of the box.
Type Parameters
Section titled “Type Parameters”T extends Record<string, unknown>
Parameters
Section titled “Parameters”T
The payload to enrich. Must be a plain object, not an array. A shallow copy is returned; the original is not mutated.
Returns
Section titled “Returns”A new object with correlationId added.
Throws
Section titled “Throws”If data is not a plain object.