Comments (10)
Based on https://github.com/fwoelffel/nest-bull/blob/master/lib/bull.providers.ts#L39 it looks like that you should have name
property defined outside of the useFactory
, like this:
@Module({
imports: [
ConfigModule,
BullModule.forRootAsync({
imports: [ConfigModule],
name: 'slack-announce',
useFactory: (configService: ConfigService) => ({
options: {
redis: {
port: 6379,
},
},
}),
inject: [ConfigService],
}),
],
providers: [SlackAnnounceRankingProcessor],
controllers: [],
})
export class SlackModule {}
This works. It doesn't seem quite right though...
from bull.
Hi @joshuajung 👋
I've look into the code and I'm affraid it won't be possible to define the queue name from the useFactory
. If you take a look at https://github.com/fwoelffel/nest-bull/blob/master/lib/bull.providers.ts#L46 (or https://github.com/fwoelffel/nest-bull/blob/13-async-array-configuration/lib/bull.providers.ts#L45 which will soon be merged into master) you can see by your self that I need the queue name to build the injection token. Thus, I can't wait for the result of the useFactory
function.
If you have an idea on how to do this, feel free to submit a PR 🙂
from bull.
@joshuajung Sorry I didn't have quite the time to investigate on this issue yet. Could you confirm that @mayorandrew's answer is fixing your issue?
@mayorandrew yup, you're right, I don't know why I implemented this non-sense. Sorry for that, I'll try to deprecate this and provide a non-breaking solution to this. Thanks for taking some of your time to have a look on this.
from bull.
@fwoelffel Happy to confirm this did the trick!
@mayorandrew Thanks a lot for your effort! I would have never found that myself.
from bull.
Awesome, thanks for your feedback. I feel like I should add a forRootAsync
example in the README.
I'm closing this.
from bull.
Hey @fwoelffel, Thanks a lot for taking the time and looking into it! Now that I know that name
is defined outside useFactory
, that's perfectly fine for me. Unfortunately, my skills won't suffice for making a meaningful contribution here. Thanks again!
from bull.
Just ran into this now in 2020.
The docs do not detail this at all:
https://docs.nestjs.com/techniques/queues
Would someone with the appropriate power be able to update the docs to include a name
property in the proper location in the .registerQueueAsync
section? This would have taken me many hours to figure out without this thread.
from bull.
@JVMartin I've just pushed an update to the docs. Thanks!
from bull.
@JVMartin Acabei de enviar uma atualização aos documentos. Obrigado!
Did you test this? The documentation is not clear to those who are starting.
I have the same problem.
**queues.config.module.ts**
@Module({
imports: [
BullModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (configService: ConfigService) => ({
redis: {
host: configService.get('REDIS_HOST'),
port: configService.get('REDIS_PORT'),
},
}),
}),
QuotesQueueModule
]
})
export class QueuesModule {}
**queues.service.ts**
@Injectable()
class BullConfigService implements BullOptionsFactory {
createBullOptions(): BullModuleOptions {
return {
redis: {
host: 'localhost',
port: 6379,
},
};
}
}
**error:**
(node:261) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 0.0.0.0:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14)
(node:261) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
from bull.
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
from bull.
Related Issues (20)
- Support processor with observables HOT 1
- Support multiple rate limits HOT 1
- Processors with multiple processes inconsistently process jobs HOT 1
- BullModule.registerQueue duplicates Module load HOT 2
- Global concurrency limit HOT 5
- Not initialising the processor with decorator HOT 1
- Facilitate queue metrics collection HOT 2
- Bull does paralel job when in processor implemented more processes. HOT 1
- Bull events + Nestjs request scoped dependencies
- Support BullMQ v5.0.0 HOT 3
- Bull Module not connecting as expected HOT 1
- Missing WorkerOptions types on BullQueueAdvancedProcessor and BullQueueAdvancedSeparateProcessor HOT 1
- options.family is not cast to number if given in REDIS_URL HOT 1
- Bull support for durable request scoped processors. HOT 4
- Give ability to disable job processing in `BullModule.forRoot` method HOT 1
- Mismatch with bull HOT 2
- NestJS Bull appears to be utilizing Upstash Redis unnecessarily. HOT 1
- Controls for nestjs/bullmq processors in request-scoped providers HOT 4
- Ability to accept/reject jobs before being processed HOT 1
- On application shutdown it closes all the queues. If any active job is creating more jobs it will fail. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bull.