Skip to content
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

How do I send multiple Jobs in one Queue or run multiple Queues #11

Open
yusuf1494 opened this issue Jun 9, 2020 · 2 comments
Open

Comments

@yusuf1494
Copy link

yusuf1494 commented Jun 9, 2020

Hi there, first of all I'm new to node js and adonis so bear with me please. So I was trying to make some heavy process running on queue, including send emails and write some history logs.

Event.on('approve::spending_house', async (parameters)=>{
console.log('HISTORY LOG & EMAIL EVENT FIRED!')
await Queue.select('high').andDispatch(new SendEmailApprovePerHouse(parameters.arrayDeptIdEmail, parameters.arrayHouseIdEmail, parameters.year, parameters.logModel, parameters.sendEmailPerBO, parameters.divisi_id))
})

as you can see I created a Job named SendEmailApprovePerHouse it was working fine. But when I add another Job and put it in different event, it shows error Cannot call Queue#process twice.

This is how I defined the new Job in another event:

Event.on('approve::spending_house', async (parameters)=>{
console.log('HISTORY LOG & EMAIL EVENT FIRED!')
await Queue.select('high').andDispatch(new SendEmailApprovePerHouse(parameters.arrayDeptIdEmail, parameters.arrayHouseIdEmail, parameters.year, parameters.logModel, parameters.sendEmailPerBO, parameters.divisi_id))
})
Event.on('reject::spending_house', async (parameters)=>{
console.log('HISTORY LOG & EMAIL EVENT FIRED!')
await Queue.select('high').andDispatch(new SendEmailRejectPerHouse(parameters.arrayDeptIdEmail, parameters.arrayHouseIdEmail, parameters.year, parameters.logModel, parameters.sendEmailPerBO, parameters.divisi_id))
})`

How can I add another Job or Queue?
Thanks.

@isocroft
Copy link
Contributor

Hey @yusuf1494 , thanks for logging this issue :) . I see you are logging a bug. However, you didn't follow our template format for reporting bugs delineated here. Please, help us by repurposing your issue to conform with this template format.

Provide the version of NodeJS you are using.
Provide the version of this library which you are using

And all other pertinent info, requested by our issue template

Thank you.

@isocroft
Copy link
Contributor

isocroft commented Jan 2, 2021

Hello @yusuf1494 , Happy New Year!! Please provide more information to help us make the library better... Thanks 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants