chore: src/modules/demo/queue/comm.ts
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
import { BaseCoolQueue, CoolQueue } from '@cool-midway/task';
|
||||||
|
import { IMidwayApplication } from '@midwayjs/core';
|
||||||
|
import { App } from '@midwayjs/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通队列
|
||||||
|
*/
|
||||||
|
@CoolQueue()
|
||||||
|
export class DemoCommQueue extends BaseCoolQueue {
|
||||||
|
@App()
|
||||||
|
app: IMidwayApplication;
|
||||||
|
|
||||||
|
async data(job: any, done: any): Promise<void> {
|
||||||
|
// 这边可以执行定时任务具体的业务或队列的业务
|
||||||
|
console.log('数据', job.data);
|
||||||
|
// 抛出错误 可以让队列重试,默认重试5次
|
||||||
|
//throw new Error('错误');
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user