Add support for jobs & queueables, migrations
- Create migration directives & migrators - Modify Cache classes to support array manipulation - Create Redis unit and RedisCache implementation - Create Queueable base class and Queue class that uses Cache backend
This commit is contained in:
25
src/service/Queueables.ts
Normal file
25
src/service/Queueables.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import {CanonicalStatic} from './CanonicalStatic'
|
||||
import {Singleton, Instantiable, StaticClass} from '../di'
|
||||
import {CanonicalDefinition} from './Canonical'
|
||||
import {Queueable} from '../support/queue/Queue'
|
||||
|
||||
/**
|
||||
* A canonical unit that resolves Queueable classes from `app/queueables`.
|
||||
*/
|
||||
@Singleton()
|
||||
export class Queueables extends CanonicalStatic<Queueable, Instantiable<Queueable>> {
|
||||
protected appPath = ['queueables']
|
||||
|
||||
protected canonicalItem = 'job'
|
||||
|
||||
protected suffix = '.job.js'
|
||||
|
||||
public async initCanonicalItem(definition: CanonicalDefinition): Promise<StaticClass<Queueable, Instantiable<Queueable>>> {
|
||||
const item = await super.initCanonicalItem(definition)
|
||||
if ( !(item.prototype instanceof Queueable) ) {
|
||||
throw new TypeError(`Invalid middleware definition: ${definition.originalName}. Controllers must extend from @extollo/lib.Queueable.`)
|
||||
}
|
||||
|
||||
return item
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user