Skip to main content
Skip to main content

BatchJobService

internal.internal.BatchJobService

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
batchJobRepository_Repository<BatchJob>Required
batchJobStatusMapToPropsMap<BatchJobStatus, { entityColumnName: string ; eventType: string }>Required
eventBus_EventBusServiceRequired
manager_EntityManagerRequired
strategyResolver_StrategyResolverServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CANCELEDstringRequired
Events.COMPLETEDstringRequired
Events.CONFIRMEDstringRequired
Events.CREATEDstringRequired
Events.FAILEDstringRequired
Events.PRE_PROCESSEDstringRequired
Events.PROCESSINGstringRequired
Events.UPDATEDstringRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited from

TransactionBaseService.activeManager_

Methods

atomicPhase_

Protected atomicPhase_<TResult, TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>

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.

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

Promise<TResult>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


cancel

cancel(batchJobOrId): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

complete

complete(batchJobOrId): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

confirm

confirm(batchJobOrId): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

create

create(data): Promise<BatchJob>

Parameters

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

listAndCount

listAndCount(selector?, config?): Promise<[BatchJob[], number]>

Parameters

Returns

Promise<[BatchJob[], number]>

PromisePromise<[BatchJob[], number]>Required

prepareBatchJobForProcessing

prepareBatchJobForProcessing(data, req): Promise<CreateBatchJobInput>

Parameters

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

Returns

Promise<CreateBatchJobInput>

PromisePromise<CreateBatchJobInput>Required

retrieve

retrieve(batchJobId, config?): Promise<BatchJob>

Parameters

batchJobIdstringRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

setFailed

setFailed(batchJobOrId, error?): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired
errorstring | BatchJobResultError

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

setPreProcessingDone

setPreProcessingDone(batchJobOrId): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

setProcessing

setProcessing(batchJobOrId): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(batchJobOrId, data): Promise<BatchJob>

Parameters

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

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

updateStatus

Protected updateStatus(batchJobOrId, status): Promise<BatchJob>

Parameters

batchJobOrIdstring | BatchJobRequired
statusBatchJobStatusRequired

Returns

Promise<BatchJob>

PromisePromise<BatchJob>Required

withTransaction

withTransaction(transactionManager?): BatchJobService

Parameters

transactionManagerEntityManager

Returns

BatchJobService

BatchJobServiceBatchJobServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?