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