-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extraProviders to registerQueueAsync #495
Comments
Would you like to create a PR for this issue? |
@kamilmysliwiec I'm afraid it'll take too much time to look up contributing guides, learn the code and write the tests (I haven't written tests before so I will also have to learn how to do it). If |
an workaround for this (I guess): export class SomeModule {
static registerAsync(options: AsyncModuleOptions): DynamicModule {
return {
module: SomeModule,
imports: [
BullModule.registerQueueAsync({
// ====================================== //
imports: [
{
module: class {},
providers: [
provide: ModuleOptionsSymbol,
useFactory: options.useFactory,
inject: options.inject,
],
exports: [ModuleOptionsSymbol]
}
],
// ====================================== //
useFactory: (options: ModuleOptions) => {
return options.redisConnectionOptions;
},
inject: [ModuleOptionsSymbol],
}),
...options.imports ?? []
],
providers: [
{
provide: ModuleOptionsSymbol,
useFactory: options.useFactory,
inject: options.inject,
}
],
exports: []
}
}
} |
I'm submitting a...
Current behavior
Currently I can't inject extra providers while using
BullModule.registerQueueAsync
, and thus I can't effectively useuseFactory
because I cannot pass any options there.Expected behavior
I use
HttpModule
where there is a keyextraProviders
and I can pass providers my factory needs, and I'd like to be able to do a similar thing with BullModule:Minimal reproduction of the problem with instructions
I will also appreciate suggestions of alternative approach, since I can't really move forward with my project now.
What is the motivation / use case for changing the behavior?
It already works in
HttpModule
this way so I'd like to see this working this way inBullModule
also.Environment
The text was updated successfully, but these errors were encountered: