---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# BatchJobService
## Constructors
### constructor
`**new BatchJobService**(«destructured»)`
#### Parameters
## Properties
`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__container__",
"type": "`any`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "__moduleDeclaration__",
"type": "`Record`",
"description": "",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "batchJobRepository_",
"type": "Repository<[BatchJob](BatchJob.mdx)>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "batchJobStatusMapToProps",
"type": "Map<[BatchJobStatus](../enums/BatchJobStatus.mdx), { entityColumnName: string ; eventType: string }>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "eventBus_",
"type": "[EventBusService](EventBusService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "manager_",
"type": "EntityManager",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "strategyResolver_",
"type": "[StrategyResolverService](StrategyResolverService.mdx)",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "transactionManager_",
"type": "`undefined` \\| EntityManager",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events",
"type": "`object`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "Events.CANCELED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.canceled\"",
"expandable": false,
"children": []
},
{
"name": "Events.COMPLETED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.completed\"",
"expandable": false,
"children": []
},
{
"name": "Events.CONFIRMED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.confirmed\"",
"expandable": false,
"children": []
},
{
"name": "Events.CREATED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.created\"",
"expandable": false,
"children": []
},
{
"name": "Events.FAILED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.failed\"",
"expandable": false,
"children": []
},
{
"name": "Events.PRE_PROCESSED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.pre_processed\"",
"expandable": false,
"children": []
},
{
"name": "Events.PROCESSING",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.processing\"",
"expandable": false,
"children": []
},
{
"name": "Events.UPDATED",
"type": "`string`",
"description": "",
"optional": false,
"defaultValue": "\"batch.updated\"",
"expandable": false,
"children": []
}
]} />
## Accessors
### activeManager\_
`Protected get**activeManager_**(): EntityManager`
#### Returns
EntityManager
## Methods
### atomicPhase\_
`Protected **atomicPhase_**(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.
#### Parameters
Promise<TResult>",
"description": "the transactional work to be done",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "isolationOrErrorHandler",
"type": "`IsolationLevel` \\| (`error`: `TError`) => Promise<void \\| TResult>",
"description": "the isolation level to be used for the work.",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
},
{
"name": "maybeErrorHandlerOrDontFail",
"type": "(`error`: `TError`) => Promise<void \\| TResult>",
"description": "Potential error handler",
"optional": true,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
Promise<TResult>
___
### cancel
`**cancel**(batchJobOrId): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### complete
`**complete**(batchJobOrId): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### confirm
`**confirm**(batchJobOrId): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### create
`**create**(data): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### listAndCount
`**listAndCount**(selector?, config?): Promise<[[BatchJob](BatchJob.mdx)[], number]>`
#### Parameters
#### Returns
Promise<[[BatchJob](BatchJob.mdx)[], number]>
___
### prepareBatchJobForProcessing
`**prepareBatchJobForProcessing**(data, req): Promise<[CreateBatchJobInput](../types/CreateBatchJobInput.mdx)>`
#### Parameters
#### Returns
Promise<[CreateBatchJobInput](../types/CreateBatchJobInput.mdx)>
___
### retrieve
`**retrieve**(batchJobId, config?): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### setFailed
`**setFailed**(batchJobOrId, error?): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### setPreProcessingDone
`**setPreProcessingDone**(batchJobOrId): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### setProcessing
`**setProcessing**(batchJobOrId): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### shouldRetryTransaction\_
`Protected **shouldRetryTransaction_**(err): boolean`
#### Parameters
` \\| `{ code: string }`",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`boolean`
___
### update
`**update**(batchJobOrId, data): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### updateStatus
`Protected **updateStatus**(batchJobOrId, status): Promise<[BatchJob](BatchJob.mdx)>`
#### Parameters
#### Returns
Promise<[BatchJob](BatchJob.mdx)>
___
### withTransaction
`**withTransaction**(transactionManager?): [BatchJobService](BatchJobService.mdx)`
#### Parameters
#### Returns
[BatchJobService](BatchJobService.mdx)