New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

adonis-jobs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adonis-jobs

This package is available in the npm registry.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

adonis-jobs

Download Version License

adonis-jobs is a queue system based on BullMQ for AdonisJS.

Note

You must have a Redis server running on your machine.


Getting Started

This package is available in the npm registry.

npm install adonis-jobs

Next, configure the package by running the following command.

node ace configure adonis-jobs

and... Voilà!

Usage

The Queue provider gives you access to the dispatch method. It will dispatch the linked job to the queue with the given payload.

import { Queue } from '@ioc:Setten/Queue';

Queue.dispatch('App/Jobs/RegisterStripeCustomer', {...});

Your Job can be stored anywhere in your application and is dispatched using its full path. It must have a handle method that will be executed by the queue worker.

// app/Jobs/RegisterStripeCustomer.ts

export type RegisterStripeCustomerPayload = {
  userId: string
}

export default class RegisterStripeCustomer {
  public async handle(payload: RegisterStripeCustomerPayload) {
    // ...
  }
}

Run the queue worker with the following ace command:

node ace queue:listen

Once done, you will see the message Queue processing started.

Typings

You can define the payload's type for a given job inside the contracts/queue.ts file.

import type { RegisterStripeCustomerPayload } from 'App/Jobs/RegisterStripeCustomer'

declare module '@ioc:Setten/Queue' {
  interface JobsList {
    'App/Jobs/RegisterStripeCustomer': RegisterStripeCustomerPayload;
  }
}

Keywords

FAQs

Package last updated on 26 Jul 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc