romainlanz / adonis-bull-queue Goto Github PK
View Code? Open in Web Editor NEWQueue system based on BullMQ for AdonisJS
License: MIT License
Queue system based on BullMQ for AdonisJS
License: MIT License
Hello,
I would like to add the package in production on Heroku, and I'm afraid that it will impact the performance of the application, what is the best way to run it in production without impacting the performance?
Thanks
Hello,
The link to the bullMQ is outdated. I will push a PR to update it.
In the same time, I will try to use the repeatable feature. If it works, I will create another PR to document it.
Hi,
starting the queue withnode ace queue:listen
leads to IocLookupException: E_IOC_LOOKUP_FAILED: Cannot resolve "Setten/Queue" namespace from the IoC Container.
Best regards,
Danny
I was evaluating the queue packages for Adonis, and I really liked the structure you've built. However, I would need to have access to the queue in order to, for example, delete all jobs. Do you think it would be interesting to have a getQueue(queueName:string)
method that could retrieve the queue itself?
Thank you!
We trying to use bull-queue after init adonis with "API Starter Kit", but there is an error when we try to run node ace configure @rlanz/bull-queue
.
node -v
# v21.6.1
How to reproduce:
npm init adonisjs@latest hello-world
Select "API Starter Kit".
Run:
npm install @rlanz/bull-queue
# and
node ace configure @rlanz/bull-queue
Get this following error: [ error ] Cannot configure module "@rlanz/bull-queue". The module does not export the configure hook
BullMQ supports graceful shutdown of workers. It would be nice if it was possible to enable this through configuration for long-running jobs.
Hi there! Is support for BullMQ flows on the roadmap for this package? ๐
Hi , when I am adding the queue with delay like this
await Queue.dispatch("App/Jobs/TestQueueJob", { type:"testing" }, { delay:5000 });
Then It's not working queue added in the Redis database but after that It's not processing. could you please help me in this .
but when we do normal dispatch without any delay then It's working fine .
Hey there! ๐๐ป
I was wondering if we should change some defaults value.
For example, adding removeOnComplete
to true
by default may be beneficial to avoid too much mess in Redis.
๐ https://docs.bullmq.io/guide/queues/auto-removal-of-jobs
is possible to conect to a redis server over ssl/tls? i have a digital ocean DB and i only works with ssl.
The job that have been finished still exist in redis. How to remove it?
First of all, thanks for making this great queue wrapper. It was quite easy to set up and I'm very happy with it ๐
Now for my question: I have an Adonis web app running on Heroku and would like to run a queue in a worker dyno. I can run it locally and it works great, but when I deploy to Heroku, I get the following error: Error: AdonisJS requires "@adonisjs/assembler" in order to run typescript source directly
This is my Procfile:
web: node build/server.js
worker: node ace queue:listen
I noticed when I run the build command (node ace build --production
), it doesn't make a new JS file for the queue/worker. Is there some way to make it generate something I can run on Heroku, like a build/queue.js
?
`
import { Queue } from '@IOC:Setten/Queue';
Queue.dispatch('App/Jobs/RegisterStripeCustomer', {...}, {
queueName: 'stripe',
});
`
This produce errors when compiling project
[ error ] typescript compiler errors app/Controllers/Http/CronJobController.ts:75:17 - error TS2769: No overload matches this call. Overload 1 of 2, '(job: "App/Jobs/CalculateUserStat", payload: CalculateUserStatPayload, options?: JobsOptions | undefined): Promise<string>', gave the following error. Argument of type '{ queueName: string; }' is not assignable to parameter of type 'JobsOptions'. Object literal may only specify known properties, and 'queueName' does not exist in type 'JobsOptions'. Overload 2 of 2, '(job: "App/Jobs/CalculateUserStat", payload: CalculateUserStatPayload, options?: JobsOptions | undefined): Promise<string>', gave the following error. Argument of type '{ queueName: string; }' is not assignable to parameter of type 'JobsOptions'. Object literal may only specify known properties, and 'queueName' does not exist in type 'JobsOptions'.
Running node ace configure @setten/bull-queue
returns:
Cannot find module 'node:path'
Require stack:
- D:\wamp64\www\quiz\node_modules\@setten\bull-queue\build\instructions.js
- D:\wamp64\www\quiz\node_modules\@poppinss\utils\build\src\esmRequire.js
- D:\wamp64\www\quiz\node_modules\@poppinss\utils\build\index.js
- D:\wamp64\www\quiz\node_modules\@adonisjs\config\build\src\Config.js
- D:\wamp64\www\quiz\node_modules\@adonisjs\config\build\index.js
- D:\wamp64\www\quiz\node_modules\@adonisjs\application\build\src\Application.js
- D:\wamp64\www\quiz\node_modules\@adonisjs\application\build\index.js
- D:\wamp64\www\quiz\node_modules\@adonisjs\core\build\standalone.js
- D:\wamp64\www\quiz\ace
at Function.Module._resolveFilename internal/modules/cjs/loader.js:880
1 Function.Module._load
internal/modules/cjs/loader.js:725
2 Module.require
internal/modules/cjs/loader.js:952
3 require
internal/modules/cjs/helpers.js:88
4 Object.<anonymous>
D:/wamp64/www/quiz/node_modules/@setten/bull-queue/build/instructions.js:9
5 Module._compile
internal/modules/cjs/loader.js:1063
6 Object.Module._extensions..js
internal/modules/cjs/loader.js:1092
7 Module.load
internal/modules/cjs/loader.js:928
8 Function.Module._load
internal/modules/cjs/loader.js:769
9 Module.require
internal/modules/cjs/loader.js:952
I have an API built with Adonis v5 that has jobs for sending messages, etc after an order has been placed. How would I go about runing the queue listener on render.com where the API is deployed?
Any assistance would be highly appreciated.
Hello,
I'm trying to run some cron actions. These actions a super simple, it's just a trigger of a command build using ace.
First, I do not know if i should use crontab from linux, a package like adonis5-schedule or this package.
I've tried adonis5-schedule and I do not know how to use it in production (i.e.: how to stop jobs when reploying my application.
For this package, I can use the feature repeat
from bull-mq but how to setup these in Adonis? I tried a prldfile but each time the server wake up, a new worker is created which is not what I want and I do not know how to manage this in production? Should I run node ace queue:listen
using pm2? That's hard to understand the purpose of this package and the problem solved.
So I think crontab is the best solution actually?
Laravel have a tasks scheduler with a lot of feature and documentation. Could we expect the same with Adonis6?
Hi Romain!
Why adonis-typing omit argument on Queue.process if it's a public method?
I have a command created by node ace make:command
where it does a Queue.dispatch('App/Jobs/ImportVariants', {id: "1"})
.
The problem I have is neither the console.log
is displayed nor does the record gets deleted (for testing purposes).
If I do the same Queue.dispatch('App/Jobs/ImportVariants', {id: "1"})
in node ace repl
it works.
Within the app/Jobs/ImportVariants.ts
I have:
import ShopifyStore from "App/Models/ShopifyStore"
export type ShopifyStorePayload = {
id: string
}
export default class ImportVariants {
public async handle(payload: ShopifyStorePayload){
console.log(payload)
let user = await ShopifyStore.findByOrFail('id', payload.id)
user.delete()
}
}
And contracts/queue.ts
:
import type {ShopifyStorePayload} from 'App/Jobs/ImportVariants'
declare module '@ioc:Setten/Queue' {
interface JobsList {
'App/Jobs/ImportVariants': ShopifyStorePayload
}
}
const RegisterStripeCustomer = () => import('App/Jobs/RegisterStripeCustomer')
Queue.dispatch(RegisterStripeCustomer, { ... })
What is best approach to run multiple workers?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.