Skip to main content
Skip to main content

BatchJobService

constructor

Parameters

__namedParametersInjectedDependenciesRequired

Properties

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
EventsobjectRequired
Events.CREATEDstringRequired

Default: "batch.created"

Events.UPDATEDstringRequired

Default: "batch.updated"

Events.PRE_PROCESSEDstringRequired

Default: "batch.pre_processed"

Events.CONFIRMEDstringRequired

Default: "batch.confirmed"

Events.PROCESSINGstringRequired

Default: "batch.processing"

Events.COMPLETEDstringRequired

Default: "batch.completed"

Events.CANCELEDstringRequired

Default: "batch.canceled"

Events.FAILEDstringRequired

Default: "batch.failed"

batchJobRepository_Repository<BatchJob>Required
eventBus_EventBusServiceRequired
strategyResolver_StrategyResolverServiceRequired
batchJobStatusMapToPropsMap<BatchJobStatus, object>Required
__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

withTransaction

Parameters

transactionManagerEntityManager

Returns

thisthisRequired

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanbooleanRequired

atomicPhase_

Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.

Type Parameters

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (error: TError) => Promise<void | TResult>
the isolation level to be used for the work.
maybeErrorHandlerOrDontFail(error: TError) => Promise<void | TResult>
Potential error handler

Returns

PromisePromise<TResult>Required
the result of the transactional work

retrieve

Parameters

batchJobIdstringRequired
configFindConfig<BatchJob>Required

Default: {}

Returns

PromisePromise<BatchJob>Required

listAndCount

Parameters

selectorFilterableBatchJobPropsRequired

Default: {}

configFindConfig<BatchJob>Required

Returns

PromisePromise<[BatchJob[], number]>Required

create

Parameters

Returns

PromisePromise<BatchJob>Required

update

Parameters

batchJobOrIdstring | BatchJobRequired
dataPartial<Pick<BatchJob, "context" | "result">>Required

Returns

PromisePromise<BatchJob>Required

confirm

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

PromisePromise<BatchJob>Required

complete

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

PromisePromise<BatchJob>Required

cancel

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

PromisePromise<BatchJob>Required

setPreProcessingDone

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

PromisePromise<BatchJob>Required

setProcessing

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

PromisePromise<BatchJob>Required

setFailed

Parameters

batchJobOrIdstring | BatchJobRequired
errorstring | BatchJobResultError

Returns

PromisePromise<BatchJob>Required

prepareBatchJobForProcessing

Parameters

reqRequest<ParamsDictionary, any, any, ParsedQs, Record<string, any>>Required

Returns

PromisePromise<CreateBatchJobInput>Required

updateStatus

Parameters

batchJobOrIdstring | BatchJobRequired
statusBatchJobStatusRequired

Returns

PromisePromise<BatchJob>Required
Was this section helpful?