Skip to main content
Skip to main content

BatchJobService

constructor​

Parameters​

__namedParametersInjectedDependenciesRequired

Properties​

__container__anyRequired
batchJobRepository_Repository<BatchJob>Required
batchJobStatusMapToPropsMap<BatchJobStatus, object>Required
eventBus_EventBusServiceRequired
manager_EntityManagerRequired
strategyResolver_StrategyResolverServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CANCELEDstringRequired

Default: "batch.canceled"

Events.COMPLETEDstringRequired

Default: "batch.completed"

Events.CONFIRMEDstringRequired

Default: "batch.confirmed"

Events.CREATEDstringRequired

Default: "batch.created"

Events.FAILEDstringRequired

Default: "batch.failed"

Events.PRE_PROCESSEDstringRequired

Default: "batch.pre_processed"

Events.PROCESSINGstringRequired

Default: "batch.processing"

Events.UPDATEDstringRequired

Default: "batch.updated"

__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors​

activeManager_​

Returns​

EntityManagerEntityManagerRequired

Methods​

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

cancel​

Parameters​

batchJobOrIdstring | BatchJobRequired

Returns​

PromisePromise<BatchJob>Required

complete​

Parameters​

batchJobOrIdstring | BatchJobRequired

Returns​

PromisePromise<BatchJob>Required

confirm​

Parameters​

batchJobOrIdstring | BatchJobRequired

Returns​

PromisePromise<BatchJob>Required

create​

Parameters​

Returns​

PromisePromise<BatchJob>Required

listAndCount​

Parameters​

selectorFilterableBatchJobPropsRequired

Default: {}

configFindConfig<BatchJob>Required

Returns​

PromisePromise<[BatchJob[], number]>Required

prepareBatchJobForProcessing​

Parameters​

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

Returns​

PromisePromise<CreateBatchJobInput>Required

retrieve​

Parameters​

batchJobIdstringRequired
configFindConfig<BatchJob>Required

Default: {}

Returns​

PromisePromise<BatchJob>Required

setFailed​

Parameters​

batchJobOrIdstring | BatchJobRequired
errorstring | BatchJobResultError

Returns​

PromisePromise<BatchJob>Required

setPreProcessingDone​

Parameters​

batchJobOrIdstring | BatchJobRequired

Returns​

PromisePromise<BatchJob>Required

setProcessing​

Parameters​

batchJobOrIdstring | BatchJobRequired

Returns​

PromisePromise<BatchJob>Required

shouldRetryTransaction_​

Parameters​

errRecord<string, unknown> | objectRequired

Returns​

booleanbooleanRequired

update​

Parameters​

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

Returns​

PromisePromise<BatchJob>Required

updateStatus​

Parameters​

batchJobOrIdstring | BatchJobRequired
statusBatchJobStatusRequired

Returns​

PromisePromise<BatchJob>Required

withTransaction​

Parameters​

transactionManagerEntityManager

Returns​

BatchJobServiceobjectRequired
Was this section helpful?