-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: update * chore: update * feat: support bull board using bullmq (#4259) Co-authored-by: gqc <[email protected]> * refactor: bull-board * fix: case * test: add more case * docs: update * docs: update * docs: update * fix: merge config * fix: try to fix test * fix: lint --------- Co-authored-by: harperKKK <[email protected]> Co-authored-by: gqc <[email protected]>
- Loading branch information
1 parent
d9d8187
commit 1fbf7fb
Showing
28 changed files
with
1,881 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import '@midwayjs/bull'; | ||
import { BullBoardOption } from './dist/index'; | ||
export * from './dist/index'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
30 changes: 30 additions & 0 deletions
30
packages/bull-board/test/fixtures/base-app-bullmq/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Configuration } from '@midwayjs/core'; | ||
import * as bullBoard from '../../../../src'; | ||
import * as bullmq from '@midwayjs/bullmq'; | ||
import * as koa from '@midwayjs/koa'; | ||
|
||
@Configuration({ | ||
imports: [ | ||
koa, | ||
bullmq, | ||
bullBoard, | ||
], | ||
importConfigs: [ | ||
{ | ||
default: { | ||
keys: 123, | ||
bullmq: { | ||
defaultConnection: { | ||
host: '127.0.0.1', | ||
port: 6379, | ||
} | ||
}, | ||
}, | ||
}, | ||
], | ||
}) | ||
export class AutoConfiguration { | ||
|
||
async onReady(){ | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../fixtures/base-app/src/task/queue.task.ts → ...es/base-app-bullmq/src/task/queue.task.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
import { ConnectionOptions } from 'bullmq'; | ||
import { BullMQConfig } from './dist/index'; | ||
export * from './dist/index'; | ||
export { Job } from 'bullmq'; | ||
import { IQueueOptions, IWorkerOptions } from './dist/index'; | ||
|
||
declare module '@midwayjs/core/dist/interface' { | ||
// bullmq 新引入了 worker 作为执行任务的实例,一个队列 queue 和 worker 中 connection, prefix 必须一致才能正常执行 | ||
// 所以 config 中 connection, prefix 单独配置 | ||
// eslint-disable-next-line | ||
interface MidwayConfig { | ||
bullmq?: { | ||
connection: ConnectionOptions; | ||
prefix?: string; | ||
defaultQueueOptions?: IQueueOptions; | ||
defaultWorkerOptions?: IWorkerOptions; | ||
clearRepeatJobWhenStart?: boolean; | ||
contextLoggerFormat?: (info: any) => string; | ||
}; | ||
bullmq?: BullMQConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// task | ||
export const BULLMQ_QUEUE_KEY = 'bullmq:queue'; | ||
export const BULLMQ_PROCESSOR_KEY = 'bullmq:processor'; | ||
export const BULLMQ_WORKER_KEY = 'bullmq:worker'; | ||
export const BULLMQ_FLOW_PRODUCER_KEY = 'bullmq:flow-producer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.