Skip to content

Commit

Permalink
feat(): add job data provider support
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Nov 16, 2020
1 parent e7e3c9c commit 246939d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/bull.explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ export class BullExplorer implements OnModuleInit {
moduleRef.providers,
contextId,
);
if (this.moduleRef.registerRequestByContextId) {
// Additional condition to prevent breaking changes in
// applications that use @nestjs/bull older than v7.4.0.
const jobRef = args[0];
this.moduleRef.registerRequestByContextId(jobRef, contextId);
}
return contextInstance[key].call(contextInstance, ...args);
};
args.push(callback);
Expand Down
3 changes: 3 additions & 0 deletions lib/bull.tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { REQUEST } from '@nestjs/core';

export const JOB_DATA = REQUEST;
1 change: 1 addition & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './bull.module';
export * from './bull.tokens';
export * from './bull.types';
export * from './decorators';
export * from './enums';
Expand Down

0 comments on commit 246939d

Please sign in to comment.