Comments (11)
Can you provide example async configuration with custom queue name and @Queue
decorator ?
from bull.
Hi @smonv
I'm sorry such a trivial task take me so long. I'll try to close this as soon as I find some time to do so. Until then, this may help you #13 (comment).
from bull.
Hi @fwoelffel , thank you for suggestion.
I'm trying to use Queue
decorator to define a class and processor and I want inject many service to that class. Do I need inject all the service when define BullModule.forRootAsync
?
from bull.
Hi @smonv, I'm really sorry that it took me so long to notice your answer.
If you're using the @Queue
decorator, you can inject the services you need into the targeted class. This is a simple Nest injection and should have nothing to do with BullModule.forRootAsync
:)
If you're still having trouble with this, I'll try to help you in much shorter terms.
from bull.
from bull.
@fwoelffel hi there, i just started to use nest-bull but i am having problems with injecting services and using it inside the queue process function. Following the example you wrote I can't even access the logger. Neither the service or the logger are available in the queue.
Is this a scope problem? the queue is in the Users Module, and there is a User Service which I need to access inside the queue. So all of them are in the UsersModule, and the Service and Queue are in providers with BullModule being imported in the imports section of the UsersModule
@Module({
imports: [
BullModule.forRoot({
name: 'user',
options: {
redis: {
port: 0000
}
}
}),
],
providers: [
UsersService,
UsersQueue
],
controllers: [UsersController],
exports: [UsersService]
})
from bull.
@anitricks That should work π€ Could you also share your UsersService
from bull.
@fwoelffel yeah sure. here is the service below. Thanks for the quick response
@Injectable()
export class UsersService extends Entity<User> {
constructor(
@InjectRepository(User) repo: Repository<User>,
connection: Connection
) {
super(repo, connection);
}
findUsers(params: { firstname?: string, lastname?: string, dob?: string }) {
//
}
}
its very weird. i've been scratching my head. I also have tried to put the UserQueue in the Application Module and injecting the Queue in Application Controller, however is was the same problem. Do I have to try forRootAsync
because of the TypeORM module?
UsersQueue
@Queue({name: 'users'})
export class UsersQueue {
private readonly logger = new Logger(this.constructor.name);
constructor(private readonly service: UsersService) { }
@QueueProcess({name: 'update'})
async defaultFunction(job: Job) {
console.log(this);
let res = await this.service.findUsers({id: job.data});
return done(null, res);
}
from bull.
I don't see any issue with your code... π€ Since we are drifting away from the original topic, would you be kind enough to create a new issue?
from bull.
yeah sorry about that. i will create a new issue
from bull.
We'll cover all that in the documentation nestjs/docs.nestjs.com#883
from bull.
Related Issues (20)
- Bug Report - High Memory Usage when Providing Float to Concurrency in Bull.js Module HOT 1
- Upgrade bullmq peer dependecy to ^4.0.0 HOT 1
- How to dynamically modify the quantity of concurrency HOT 1
- Error with Bullmq Queue provider HOT 2
- Nestjs bullmq worker processor don't works with jest HOT 1
- Get process and processer metadata HOT 1
- 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
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.