November 2017
Intermediate to advanced
298 pages
7h 10m
English
index.js is a single-file app that either sends a timestamp every 1.5 seconds to the queue or reads from the queue depending on the invocation argument. The queue location is defined by the QUEUE_HOST environment variable:
'use strict'const Queue = require('bull');const veryImportantThingsQueue = new Queue('very_important_things', { redis: { port: 6379, host: process.env.QUEUE_HOST }});// Prints any message data receivedclass Receiver { constructor () { console.info('Registering listener...'); veryImportantThingsQueue.process(job => { console.info('Got a message from the queue with data:', job.data); return Promise.resolve({}); }); }}// Sends the date every 1.5 secondsclass Sender { constructor () { function sendMessage() { const ...Read now
Unlock full access