---
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<`string`, `unknown`\\>",
"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_**<`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.
#### 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`\>
",
"optional": false,
"defaultValue": "",
"description": "the result of the transactional work",
"expandable": false,
"children": []
}
]} />
___
### cancel
**cancel**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### complete
**complete**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### confirm
**confirm**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### create
**create**(`data`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### listAndCount
**listAndCount**(`selector?`, `config?`): `Promise`<[[`BatchJob`](BatchJob.mdx)[], `number`]\>
#### Parameters
",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[[`BatchJob`](BatchJob.mdx)[], `number`]\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### prepareBatchJobForProcessing
**prepareBatchJobForProcessing**(`data`, `req`): `Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
#### Parameters
\\>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### retrieve
**retrieve**(`batchJobId`, `config?`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
",
"description": "",
"optional": false,
"defaultValue": "{}",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### setFailed
**setFailed**(`batchJobOrId`, `error?`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### setPreProcessingDone
**setPreProcessingDone**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### setProcessing
**setProcessing**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### 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
\\>",
"description": "",
"optional": false,
"defaultValue": "",
"expandable": false,
"children": []
}
]} />
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### updateStatus
`Protected` **updateStatus**(`batchJobOrId`, `status`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
#### Parameters
#### Returns
`Promise`<[`BatchJob`](BatchJob.mdx)\>
",
"optional": false,
"defaultValue": "",
"description": "",
"expandable": false,
"children": []
}
]} />
___
### withTransaction
**withTransaction**(`transactionManager?`): [`BatchJobService`](BatchJobService.mdx)
#### Parameters
#### Returns
[`BatchJobService`](BatchJobService.mdx)