rocketseat / adonis-bull Goto Github PK
View Code? Open in Web Editor NEWThe easiest way to start using an asynchronous job queue with AdonisJS. Ready for Adonis v5 ⚡️
License: MIT License
The easiest way to start using an asynchronous job queue with AdonisJS. Ready for Adonis v5 ⚡️
License: MIT License
Hello
First of all, thanks for coding this provider.
In app/controllers/http, i have the following controller:
'use strict'
const Bull = use('Rocketseat/Bull')
const RegisterDashboardJob = use('App/Jobs/RegisterDashboard')
class RegisterController {
async store({ request, response }) {
const data = {
"companyName": "test",
"firstName": "test",
"lastName": "1",
"telephone": "0349208926",
"email": "[email protected]",
"password": "123456",
"productSelect": [],
"posCategory": 1,
"gender": 1,
"username": "[email protected]",
"name": "test account",
"companyDomain": "test-46"
}
Bull.add(RegisterDashboardJob.key, data)
return response.status(201).json({
message: `Register job added to queue`
})
}
}
module.exports = RegisterController
In app/Jobs/RegisterDashboard i have the following:
'use strict'
const {
createSyncDashboardDatabase,
} = use('App/Services/SyncDatabase')
const _ = use('lodash');
const Job = use('App/Models/v2/Job')
const {simpleStringify} = use('App/Helpers/Utils')
class RegisterDashboard {
static get key () {
return 'register-dashboard-job'
}
async handle (job) {
const { data } = job
let dataInsert = {
'queue': RegisterDashboard.key,
'payload': simpleStringify(data),
'response': '',
'email': data.email,
'status': ''
}
await createSyncDashboardDatabase(data).then((dashboard) => {
Job.create(dataInsert)
}).catch(e => {
dataInsert.response = simpleStringify(e)
dataInsert.status = 500
Job.create(dataInsert)
})
}
}
module.exports = RegisterDashboard
When debug Job data transmitted is no data that controller transmits.
Could you please help me? Maybe I'm missing something here...
Data from Job be like
{
"name":"__default__",
"_progress":0,
"delay":0,
"timestamp":1593077938333,
"attemptsMade":0,
"id":"27",
"processedOn":1593077940335
}
Thanks
What would you like to be added:
The bull-board package has a config to show the dashboard on a custom route (here, inside Hello World section) using express, and i think the adonis-bull can have the same functionality.
Why is this needed:
I'll need this, because the Admin User of my system will need to retry the failed jobs if necessary.
Is your enhancement request related to a problem? Please describe.
The only problem is that the Admin User has no control over the jobs.
Additional context
Here is an image from the bull-board config that i said.
Is it possible? Or has a better way to do it?
ps: Thanks for the Adonis V5 support!!
Vendo a documentação sobre eventos aqui em https://github.com/Rocketseat/adonis-bull#events me surgiu uma dúvida:
Tem algum evento específico para quando o job finaliza as tentativas e não consegue processar?
Olha um exemplo onde tento 3 vezes:
Bull.add(SendMessageJob.key, msg, {
attempts: 3,
})
A parte dos attempts funcionou certinho, porém queria achar um modo de me disparar alguma notificação quando ele processar todos os attempts e falhar. Mas não quero detectar a falha em cada tentativa, somente quando terminar todos os attempts. Existe algum evento específico pra isso ?
I get this error when running the application after invoking the adonis5-bull package.
To fix this you need to update BullProvider.d.ts and BullProvider.js.
Replace
import { IocContract } from '@adonisjs/fold'; with import { ApplicationContract } from '@IOC:Adonis/Core/Application';
and pass the appliocation contract to constuctor as seen below
import { ApplicationContract } from '@ioc:Adonis/Core/Application';
export default class BullProvider {
protected app: ApplicationContract;
constructor(app: ApplicationContract);
register(): void;
shutdown(): Promise<void>;
}
and then make the approprite changes to BullProvider.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class BullProvider {
constructor(app) {
this.app = app;
}
register() {
this.app.container.bind('Rocketseat/Bull/BullExceptionHandler', () => {
const { BullExceptionHandler } = require('../src/BullExceptionHandler');
return BullExceptionHandler;
});
this.app.container.singleton('Rocketseat/Bull', () => {
var _a;
const app = this.app.container.use('Adonis/Core/Application');
const config = this.app.container.use('Adonis/Core/Config').get('bull', {});
const Logger = this.app.container.use('Adonis/Core/Logger');
const jobs = ((_a = require(app.startPath('jobs'))) === null || _a === void 0 ? void 0 : _a.default) || [];
const { BullManager } = require('../src/BullManager');
return new BullManager(this.app.container, Logger, config, jobs);
});
this.app.container.alias('Rocketseat/Bull', 'Bull');
}
async shutdown() {
await this.app.container.use('Rocketseat/Bull').shutdown();
}
}
exports.default = BullProvider;
Can you please fix this in the package?
Description of bug
Add a job queue library (ex Adonis Bull)
Create a job with a console log in the handle method
Create an ace command that queues the job inside the handle method
Result: Job will be executed but the command won't end (close it with CTRL+C)
Expected result: job is triggered and command closes correctly.
'use strict'
const {Command} = require('@adonisjs/ace')
const Bull = use('Rocketseat/Bull')
const ImportTagsJob = use('App/Jobs/ImportTagsJob')
const Database = use('Database')
const Redis = use('Redis')
class ImportTags extends Command {
static get signature() {
return 'process:imported-tags'
}
static get description() {
return 'Import nfc and rfid tags from S3'
}
async handle() {
Bull.add(ImportTagsJob.key)
await Database.close()
await Redis.quit()
}
}
module.exports = ImportTags
Environment:
"adonis-version": "4.1.0",
node v12.18.2
npm 6.14.10
Additional context
I also opened an issue on adonis/core (adonisjs/core#2184).
What @thetutlage is saying is that Bull opens their connection to Redis so I have to somehow close that connection and not the one of Adonis Provider.
I have a process that adds a single item to the queue and it works perfectly.
I have another process that adds 10 items to the queue, but they all process at the same time, I was expecting 1 at a time but can't get this process to work like this. What am I missing?
Working Code:
async handle (args, options) {
// get env
const appEnv = Config.get("app.environment");
// get company id from cli argument
const clientID = args.company;
// Data to be passed to job handle
const data = {
id: clientID
};
this.info(`Queueing ${clientID} Job in ${appEnv}`);
await Bull.add(Job.key, {
id: clientID
});
this.info("Job Queued");
process.exit();
}
If I modify that script and add the following, all 3 will process immediately, is there any way to change this?
await Bull.add(Job.key,{
id: 1
});
await Bull.add(Job.key,{
id: 2
});
await Bull.add(Job.key,{
id: 3
});
I am trying to configure a queue with "attempts" field number.
I need to retry again in my interval configuration time if job fail, not at once.
As described in official bull documentation. For each new attempt the job is put on delayed mode, but this seems to not working.
How can I configure that?
Bull.add(ForgotPasswordMail.key, {
email: user.email,
token: user.token
}, {
delay: 2000,
attempts: 3
});
With this configuration, the delay work until begin processing, after 2000ms the code run 3 times without interval between execution.
Good night.
Where are stored the data showed on the job statistics displayed on Bull Dashboard?
Need to clear them here but don't found!
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path D:\Documents\3C\3c-perdas\node_modules\body-parser\node_modules\debug
npm ERR! dest D:\Documents\3C\3c-perdas\node_modules\body-parser\node_modules.debug.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\Documents\3C\3c-perdas\node_modules\body-parser\node_modules\debug' -> 'D:\Documents\3C\3c-perdas\node_modules\body-parser\node_modules.debug.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Victor\AppData\Roaming\npm-cache_logs\2020-12-18T12_51_38_733Z-debug.log
Sempre que tento instalar o pacote aparece esse erro
Когда я беру свой проект с гитхаба
То есть беру проект без папки node_modules
И устанавливаю пакеты npm install
Возникает такой баг
console
[ info ] building project...
[ info ] starting http server...
TypeError: this.container.bind is not a function
1 BullProvider.register
\blog\node_modules\@rocketseat\adonis-bull\build\providers\BullProvider.js:11
2 anonymous
\blog\node_modules\@adonisjs\fold\build\src\Registrar\index.js:103
3 Registrar.register
\blog\node_modules\@adonisjs\fold\build\src\Registrar\index.js:101
4 anonymous
\blog\node_modules\@adonisjs\application\build\src\Application.js:515
5 Application.registerProvidersa
\blog\node_modules\@adonisjs\application\build\src\Application.js:509
6 HttpServer.wire
\blog\node_modules\@adonisjs\core\build\src\Ignitor\HttpServer\index.js:52
7 HttpServer.start
\blog\node_modules\@adonisjs\core\build\src\Ignitor\HttpServer\index.js:146
[ warn ] Underlying HTTP server died with "0 code"
[ info ] watching file system for changes
package.json
{
"name": "adonis-ts-adminpanel",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "node ace build --production",
"start": "node server.js",
"dev": "node ace serve --watch",
"lint": "eslint . --ext=.ts"
},
"devDependencies": {
"@adonisjs/assembler": "^5.0.1",
"adonis-preset-ts": "^2.0.0",
"eslint": "^7.20.0",
"eslint-plugin-adonis": "^1.2.1",
"pino-pretty": "^4.5.0",
"typescript": "^4.1.5",
"youch": "^2.1.1",
"youch-terminal": "^1.0.1"
},
"dependencies": {
"@adonisjs/auth": "^5.1.1",
"@adonisjs/bodyparser": "^7.0.1",
"@adonisjs/core": "^5.0.4-preview-rc-2.1",
"@adonisjs/lucid": "^10.0.0",
"@adonisjs/mail": "^5.2.3",
"@adonisjs/redis": "^6.0.2",
"@adonisjs/repl": "^1.1.6",
"@rocketseat/adonis-bull": "^1.0.0-2",
"@types/node-telegram-bot-api": "^0.51.1",
"@types/socket.io": "^2.1.13",
"adonis-fcm": "^1.0.1-rc1",
"geoip-lite": "^1.4.2",
"google-auth-library": "^7.0.2",
"inbox": "^1.1.59",
"luxon": "^1.26.0",
"mailparser": "^3.1.0",
"mysql": "^2.18.1",
"phc-argon2": "^1.1.0",
"proxy-addr": "^2.0.6",
"reflect-metadata": "^0.1.13",
"server-destroy": "^1.0.1",
"socket.io": "^3.1.1",
"socketio-jwt": "^4.6.2",
"source-map-support": "^0.5.19",
"telegraf": "^4.1.1"
}
}
What would you like to be added:
Queues should be registered on provider boot method, instead of register method.
This allows using other packages without needing to fight the package import order
Implement jobs as a abstract class instead of a interface
This allows for many things, for example:
Receive queue/queue key array as a parameter for listen command (or possibility of loading a custom jobs declaration file)
This allows running queues of higher priority on different machines
Is your enhancement request related to a problem? Please describe.
Only the provider boot method causes problems, the rest is only for quality of life
I'm willing to work on this if aproved
I'd like to start a project with Adonis V5 but i'd like to know if adonis-bull work with this version of adonis ?
Thanks in advance !
Description of bug
onWaiting()
not being called when a job goes in to waiting
To Reproduce
Expected behavior
onWaiting to call when job goes in to waiting
onActive
, onCompleted
and onFailed
work fine. Not sure what's going on with onWaiting
. I checked onDrained
too and it doesnt appear to fire either. Not sure if I'm doing something wrong.
What is the best setup for multiple workers?
Description of bug
As described in the alpha version documentation, it is possible to overwrite the queue / job options, however the options are not applied at the time of execution.
As the example below, I configured some options, among them the removeOnComplete option, when adding the Job in a queue the options are not inserted.
In the adonis4 version these settings work correctly
To Reproduce
Configure Job:
export default class AlertsJob implements JobContract {
public key = 'alertsJob'
public options: JobsOptions = {
delay: 1500,
attempts: 2,
removeOnComplete: true,
backoff: {
type: 'exponential',
delay: 3000,
},
}
....
Expected behavior
After the Job runs without errors, it must be removed from the queue
Exception or Error
Job remains in queue and the options defined are not part of the data
Screenshots
Environment:
Additional context
Hello, i follow all steps on https://github.com/Rocketseat/adonis-bull/tree/alpha
But when i try dipatch job i got error:
Cannot read property 'bull' of undefined
err: {
"type": "TypeError",
"message": "Cannot read property 'bull' of undefined",
"stack":
TypeError: Cannot read property 'bull' of undefined
at BullManager.add (/var/www/myapp/node_modules/@rocketseat/adonis-bull/build/src/BullManager.js:75:34)
at TrackingController.add (/var/www/myapp/app/Controllers/Http/TrackingController.ts:12:10)
at Injector.callAsync (/var/www/myapp/node_modules/@adonisjs/fold/build/src/Ioc/Injector.js:124:30)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
"status": 500
}
Also, when i try call node ace bull:listen
process output:
{ board: undefined }
[1628705465006] INFO (myapp/2046 on MacBook-Air-Igor.local): Queue processing started
And immediately shutdown.
package.json
"@adonisjs/core": "^5.1.11",
"@rocketseat/adonis-bull": "^1.0.4",
Tem previsão se e quando esse pacote vai começar a ser migrado para o Adonis V5?
What would you like to be added:
I would like to change the current JobContract interface, to an abstract class instead, so it's possible to define key as a static member
Why is this needed:
So when adding new jobs its not necessary to call new Job().key, just Job.key, reducing instantiations made by the app and making the code prettier
Eu possuo uma tarefa onde construo uma estrutura JSON para gráfico que é ativada sempre que um cliente atualiza ou finaliza um serviço. Gostaria de, ao iniciar essa tarefa, verificar se existe a mesma tarefa em fila para apaga-las, já que o resultado será o mesmo que a tarefa que tinha acabado de finalizar
Thanks again for the migration to Adonis5. :)
I am wondering where I can set up my job tasks that should occur daily. Something that should happen when the Adonis server has started.
import Bull from '@ioc:Rocketseat/Bull'
Bull.add('MyJobKey', {}, { repeat: { cron: "0 30 12 * * WED,FRI" })
If you have any idea. In the past, I was using an Igniter hook but I don't know if there is an equivalent for Adonis 5 :)
Olá pessoal da rocket e demais devs =)
to fazendo minhas filas e fui testar a configuração do bull.js definindo um "max" e "duration" dentro de "limiter" para testar o envio de emails com regras do limitador até por que como todos sabem o AWS SES tem regras de limite de envio mas mesmo configurando como pede a doc não funcionou o bull processou todos juntos sem delay! segue outras informações:
config/bull.js:
"use strict";
const Env = use("Env");
module.exports = {
// redis connection
connection: Env.get("BULL_CONNECTION", "local"),
bull: {
limiter:{
max: 1,
duration: 1000000000
},
redis: {
host: "0.0.0.0",
port: 6379,
password: null,
db: 0,
keyPrefix: ""
}
},
remote: "redis://localhost:6379"
};
User_Controller.js:
Register user:
Bull.add('USER_WELCOME', UserInfos) Bull.add('USER_WELCOME', UserInfos) Bull.add('USER_WELCOME', UserInfos) Bull.add('USER_WELCOME', UserInfos)
todos os emails chegam juntos:
Gostaria que alguém me informa-se se eu to fazendo algo de errado ou se é um erro mesmo?
Outra duvida que não vi na documentação#Offtopic:
Como faço pra verificar se o job foi processado com sucesso? no final da documentação tem como capturar os erros dos jobs mais não tem sobre o sucesso de jobs que estão na fila aguardando ser processados...
Hello,
Need to handle scheduled jobs, like List (only) scheduled jobs in all queue, and pause/resume scheduled jobs. Tryed to use bull.queues
but cannot make it works.
Hi!
First of all, thanks for coding this provider. I'm pretty new to development and not all things are clear.
I'm facing the following issue at the moment:
Missing process handler for job type 64788854000167
This happens when I try to add more than one job on the same controller...
How things are set up here:
Under app/jobs, I have two classes:
Basically they call a vendor endpoint to register data...
In start/jobs.js, I have the following:
module.exports = ['App/Jobs/CreateCustomer', 'App/Jobs/CreateSubAccount']
In config/bull.js, I have the following:
'use strict'
const Env = use('Env')
module.exports = {
// redis connection
connection: Env.get('BULL_CONNECTION', 'BULL')
}
In preloads/bull.js, I have the following:
const Bull = use('Rocketseat/Bull')
Bull.process()
// Optionally you can start BullBoard:
Bull.ui()
// http://localhost:9999
This is the server.js:
'use strict'
const { Ignitor } = require('@adonisjs/ignitor')
new Ignitor(require('@adonisjs/fold'))
.appRoot(__dirname)
.preLoad('preloads/bull')
.fireHttpServer()
.catch(console.error)
Under app/controllers/http, i have the following controller:
'use strict'
const Bull = use('Rocketseat/Bull')
const createCustomerJob = use('App/Jobs/CreateCustomer')
const createSubAccountJob = use('App/Jobs/CreateSubAccount')
class CustomerController {
async store({
request,
response
}) {
const customer = {
email: request.body.email,
name: request.body.name,
cpf_cnpj: request.body.cpf_cnpj,
zip_code: request.body.zip_code,
number: request.body.number,
street: request.body.street,
city: request.body.city,
state: request.body.state,
complement: request.body.complement,
phone_prefix: request.body.phone_prefix,
phone: request.body.phone
}
Bull.add(createCustomerJob.key, customer)
Bull.add(createSubAccountJob.key, customer.cpf_cnpj)
return response.status(201).json({
message: `Job added to queue`
})
}
}
module.exports = CustomerController
When I was adding only one job, things were working fine, now that I added another job, the second one is throwing the error I mentioned...
Could you please help? Maybe I'm missing something here...
Thanks
const Bull = use("Rocketseat/Bull");
Bull.process()
// Optionally you can start BullBoard:
.ui(9999); // http://localhost:9999 // I change this line to ex: admin/jobs ..... app fails
// You don't need to specify the port, the default number is 9999
I need to protect this route.
Description of bug
i am getting an error and the server is stopping after update @adonisjs/core from 5.0.4-preview-rc
to 5.1.5
To Reproduce
Just update @adonisjs/core to 5.1.5
Exception or Error
TypeError: this.container.bind is not a function
1 BullProvider.register
/home/workspace/node_modules/@rocketseat/adonis-bull/build/providers/BullProvider.js:11
2 anonymous
/home/workspace/node_modules/@adonisjs/fold/build/src/Registrar/index.js:103
3 Registrar.register
/home/workspace/node_modules/@adonisjs/fold/build/src/Registrar/index.js:101
4 anonymous
/home/workspace/node_modules/@adonisjs/application/build/src/Application.js:530
5 Application.registerProviders
/home/workspace/node_modules/@adonisjs/application/build/src/Application.js:524
6 HttpServer.wire
/home/workspace/node_modules/@adonisjs/core/build/src/Ignitor/HttpServer/index.js:52
7 HttpServer.start
/home/workspace/node_modules/@adonisjs/core/build/src/Ignitor/HttpServer/index.js:146
Environment:
Ubuntu 20.04.2 LTS
Node v14.5.0
{
"name": "test",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "node ace build --production",
"start": "node server.js",
"dev": "node ace serve --watch"
},
"devDependencies": {
"@adonisjs/assembler": "^3.0.0",
"adonis-preset-ts": "^2.1.0",
"pino-pretty": "^4.7.1",
"typescript": "~4.1",
"youch": "^2.2.1",
"youch-terminal": "^1.1.0"
},
"dependencies": {
"@adonisjs/core": "~5.1.5",
"@adonisjs/repl": "^1.0.0",
"@rocketseat/adonis-bull": "^1.0.0-2",
"proxy-addr": "^2.0.6",
"reflect-metadata": "^0.1.13",
"source-map-support": "^0.5.19"
}
}
Additional context
Works fine with "@adonisjs/core": "^5.0.4-preview-rc"
Acredito ter achado um possível erro na documentação. Nesse ponto do Readme está informando que deverá ser importado o Mail através de uma const no topo do arquivo. Só que aqui pra mim aparece o seguinte erro...
Error: Cannot find module 'Adonis/Src/View'
Então o seguinte ajuste foi feito aqui no meu código:
async handle(job) {
const Mail = use('Mail');
const { data } = job;
....
E o server reiniciou normalmente. Confere?
I would like to check if a job has already been registered before launching another one. What is the best way?
Hello, i have some jobs that are a bit slow and need to show the running progress.
So, How can i update a job progress information ?
I've setup my docker container and set my redis connection to the connection below
kubernetes: { host: Env.get('REDIS_HOST', '127.0.0.1'), port: Env.get('REDIS_PORT', 6379), password: Env.get('REDIS_PASSWORD', null), db: Env.get('REDIS_DB', 6), }
but each time I run the code it trys to connect to 127.0.0.1.
After some debugging, I was able to get it work by changing
this.config = redis[connection]
to
this.config = {redis: redis[connection]}
It seems like the Bull Queue is looking for a redis key with a config in the documentation example below. The current code is only passing the config without the redis key, so it's causing me connection issues.
var audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1', password: 'foobared'}}); // Specify Redis connection using object
Can you validate this so I can put in a PR to fix?
Eu tenho uma dúvida quanto ao Bull, dentro do método handle, como eu digo que algo não deu certo?
Por exemplo, dependendo da resposta de uma API, quero que a fila tente executar a ação novamente mais tarde.
async handle(job) {
const { data } = job;
...
return data;
}
Seria só lançar uma Exception?
throw new Error('Deu erro...')
Hello,
I just figured it out how to register the command to process jobs from node ace and it is not on docs.
const aceProviders = [
'@rocketseat/adonis-bull/providers/Command',
]
Could you add it to docs?
Im trying to use your provider but once I add te preload to the server it brokes everything with this error:
TypeError: queue.Job is not a constructor
Queue.js line 146:
const Job = new queue.Job()
Any idea?
Redis Key Prefix is not documented somewhere in v5.
Taking a look at this line we can see that all configuration from this provider come from config/redis.js
.
Since this is missing in the README
and I have nowhere near your experience with AdonisJS, I'll ask:
Is this step implicit? I know this file is created when we install the official Redis provider. Is this something that is expected of those who use this provider to be aware of?
Should this be added to the documentation?
Or would be better to move all provider settings to the config/bull.js
file?
Installation with adonis install @rocketseat/adonis-bull
fails
To Reproduce
Type adonis install @rocketseat/adonis-bull in terminal.
Expected behavior
Installation of the the librrary
Exception or Error
Command failed: npm i --save @rocketseat/adonis-bull@legacy
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @rocketseat/adonis-bull@legacy.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Screenshots
Environment:
OS: macOS 11.3.1
Node: v12.22.1
Adonis: 4.1.0
Additional context
LOG-File:
1 verbose cli 'i',
1 verbose cli '--save',
1 verbose cli '@rocketseat/adonis-bull@legacy'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 2750695b08ab55c7
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/@rocketseat%2fadonis-bull 795ms (from cache)
8 silly registry:manifest no matching version for @rocketseat/adonis-bull@legacy in the cache. Forcing revalidation.
9 http fetch GET 200 https://registry.npmjs.org/@rocketseat%2fadonis-bull 197ms
10 silly fetchPackageMetaData error for @rocketseat/adonis-bull@legacy No matching version found for @rocketseat/adonis-bull@legacy.
11 timing stage:rollbackFailedOptional Completed in 1ms
12 timing stage:runTopLevelLifecycles Completed in 2075ms
13 verbose type tag
14 verbose stack @rocketseat/adonis-bull: No matching version found for @rocketseat/adonis-bull@legacy.
14 verbose stack at pickManifest (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:122:13)
14 verbose stack at /Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:43:18
14 verbose stack at tryCatcher (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
14 verbose stack at Promise._settlePromiseFromHandler (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)
14 verbose stack at Promise._settlePromise (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
14 verbose stack at Promise._settlePromise0 (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:619:10)
14 verbose stack at Promise._settlePromises (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:699:18)
14 verbose stack at _drainQueueStep (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
14 verbose stack at _drainQueue (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
14 verbose stack at Async._drainQueues (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
14 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/Users/dspangenberg/.nvm/versions/node/v12.22.1/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
14 verbose stack at processImmediate (internal/timers.js:461:21)
15 verbose cwd /Users/dspangenberg/Projects/tourismusnetz.com/japi
16 verbose Darwin 20.4.0
17 verbose argv "/Users/dspangenberg/.nvm/versions/node/v12.22.1/bin/node" "/Users/dspangenberg/.nvm/versions/node/v12.22.1/bin/npm" "i" "--save" "@rocketseat/adonis-bull@legacy"
18 verbose node v12.22.1
19 verbose npm v6.14.12
20 error code ETARGET
21 error notarget No matching version found for @rocketseat/adonis-bull@legacy.
22 error notarget In most cases you or one of your dependencies are requesting
22 error notarget a package version that doesn't exist.
23 verbose exit [ 1, true ]
I believe it'll be a good addition if an ace command existed to generate a job file.
E.g.: adonis make:job SendEmail
creates a app/Jobs/SendEmail.js
from an existing template.
We're working on integration with adonis v5.
Special thanks @RodolfoSilva for initializing the implementation in PR #39
Hi, a quick question, how do I change the initialisation from http server to node ace command after setup? for alpha branch
Hello friends! I am trying to test the sending of e-mails that is being done within a Job.
The problem I found was that the Mail.fake () functionality does not work when the email is fired from within the Job. It works if the e-mail triggered from a Controller for example.
Do you have any idea how I can get around this?
Thanks for such a great library.
Considering that kue is no longer maintained, bull serves as a better alternative.
I'll love to find out if this library is currently stable for production?
Thank you for your work.
Correct me if I am wrong but it seems that this implementation makes 1 to 1 relation between JobContract and Queue it is running against (Adonis 5).
Here is an example of a use case: upload file and process every single line. So job would be - single line processing. All lines are added to the queue. Now I want to upload second file at the same time, but it is added to the same queue. It would be great that they had their own queues, so one could stop/pause, monitor progress of each file being processed.
I tried
export default class MyJob implements JobContract {
constructor(key) {
this.key = key
}
}
So it assigns queue key on Job creation. But no luck, and digging deeper it seems that all Job classes are instantiated once and mapped to keys they have on boot.
Hope that makes sense. Maybe it is possible and I missing something.
Cheers
Tenho uma api onde preciso enviar notificações
Nessa api tem uma lista com notificaçoes a serem enviadas ao decorrer do dia.
As primeiras sempre vão tudo certinho
Mas após uma duas horas as outras notificações não são enviadas.
Alguém já passou por isso?
Adicionei try catch em todo passo para ver se dar algum erro, mas não tem erro algum
Description of issue
I know we can schedule a job to run weekly. Is there the possibility of running the monthly repetition choosing the day or would I have to perform the daily check to perform in such a way?
Usage example
Para rodar o job todos os dias as 05:30 da manhã, o que devo fazer?
Adonis esta laçando esse warning quando iniciado.
WARNING: Adonis has detected an unhandled promise rejection, which may cause undesired behavior in production. To stop this warning, use catch() on promises or wrap await calls inside try/catch.
Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1129:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
The task below will trigger the following error when called.
TypeError: this.myMethod is not a function
export default class MyTask implements JobContract {
public key = 'theTaskKey'
public async handle(job) {
this.myMethod()
}
public async myMethod() {}
}
Is there a way to call a method from the same class inside handle()
?
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.