-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add the bullBoardManager class along with documentation (#3798
- Loading branch information
1 parent
61d7894
commit fe1b619
Showing
6 changed files
with
128 additions
and
6 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Singleton } from '@midwayjs/core'; | ||
import { createBullBoard } from '@bull-board/api'; | ||
import { BaseAdapter } from '@bull-board/api/dist/src/queueAdapters/base'; | ||
|
||
@Singleton() | ||
export class BullBoardManager { | ||
private bullBoard: ReturnType<typeof createBullBoard>; | ||
|
||
public setBullBoard(bullBoard: ReturnType<typeof createBullBoard>) { | ||
this.bullBoard = bullBoard; | ||
} | ||
|
||
public getBullBoardOrigin(): ReturnType<typeof createBullBoard> { | ||
return this.bullBoard; | ||
} | ||
|
||
public addQueue(queue: BaseAdapter) { | ||
this.bullBoard.addQueue(queue); | ||
} | ||
|
||
public removeQueue(queueOrName: string | BaseAdapter) { | ||
this.bullBoard.removeQueue(queueOrName); | ||
} | ||
|
||
public replaceQueues(newBullQueues: readonly BaseAdapter[]) { | ||
this.bullBoard.replaceQueues(newBullQueues); | ||
} | ||
|
||
public setQueues(newBullQueues: readonly BaseAdapter[]) { | ||
this.bullBoard.setQueues(newBullQueues); | ||
} | ||
} |
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 @@ | ||
export { BullBoardConfiguration as Configuration } from './configuration'; | ||
export * from './board.middleware'; | ||
export * from './board.manager'; | ||
export * from './interface'; | ||
export * as BullBoard from '@bull-board/api'; |
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