Data & Services

Queue & scheduler

Dispatch in-memory jobs and run scheduled callbacks through Artisan.

Beta · v0.2.0Lanjit APIs may change before the stable release. Review the release notes and upgrade guide before updating.

Register named queue handlers, dispatch payloads, and process them with node artisan queue:run. Define scheduled callbacks in routes/console.js and execute due tasks with node artisan schedule:run. Queue data is in-memory and does not survive restarts.

Examples

app.make('queue').register('send-email', async (payload) => {
  await mailer.send(payload.to, payload.subject);
});
app.make('queue').dispatch('send-email', {
  to: 'user@example.com',
  subject: 'Selamat datang',
});
node artisan queue:run
export default function commands({ schedule, app }) {
  schedule.call(async () => {
    await app.make('log').info('Cleanup started');
  }).hourly();

  schedule.call(() => refreshMetrics()).everyFiveMinutes();
}
node artisan schedule:run
Edit this page on GitHub

Type to search all documentation.