You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
990 B
29 lines
990 B
import {FactoryProducer, Instantiable} from '../../../di'
|
|
import {Maybe} from '../../../util'
|
|
import {Queue} from './Queue'
|
|
import {SyncQueue} from './SyncQueue'
|
|
import {ConfiguredSingletonFactory} from '../../../di/factory/ConfiguredSingletonFactory'
|
|
|
|
/**
|
|
* Dependency container factory that matches the abstract Queue token, but
|
|
* produces an instance of whatever Queue driver is configured in the `server.queue.driver` config.
|
|
*/
|
|
@FactoryProducer()
|
|
export class QueueFactory extends ConfiguredSingletonFactory<Queue> {
|
|
protected getConfigKey(): string {
|
|
return 'server.queue.driver'
|
|
}
|
|
|
|
protected getDefaultImplementation(): Instantiable<Queue> {
|
|
return SyncQueue
|
|
}
|
|
|
|
protected getAbstractImplementation(): any {
|
|
return Queue
|
|
}
|
|
|
|
protected getDefaultImplementationWarning(): Maybe<string> {
|
|
return 'You are using the default synchronous queue driver. It is recommended you configure a background queue driver instead.'
|
|
}
|
|
}
|