Skip to content

registerJobContext

registerJobContext(options): () => void

Defined in: packages/pipeline-job-context/src/register-job-context.ts:38

Makes options the job context of this process: withJobContext stamps payloads with it, @InJobContext() restores it, and @AsSystem declares system principals through it. One application registers it once, at startup.

JobContextOptions

A function that removes this registration, for shutdown.

() => void

TypeError when tenants is empty.

const unregister = registerJobContext({
principal: new SessionJobPrincipal(sessions),
tenants: ['acme', 'globex'],
sources: { tenantId: tenantSource, correlationId: correlationSource },
});
process.on('SIGTERM', unregister);