| 106 | let retryCount = 0; |
| 107 | |
| 108 | @Processor('retryTask') |
| 109 | class RetryTask implements IProcessor { |
| 110 | @MainApp() |
| 111 | app: Application; |
| 112 | |
| 113 | async execute(params: any): Promise<void> { |
| 114 | retryCount++; |
| 115 | if (retryCount < 3) { |
| 116 | throw new Error('Simulated failure'); |
| 117 | } |
| 118 | this.app.setAttr('retrySuccess', true); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | const app = await createLightApp({ |
| 123 | imports: [bullmq], |