Skip to content

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

@yusuf1494

Description

@yusuf1494

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions