Skip to content

Instantly share code, notes, and snippets.

@devloic
devloic / worker.js
Created June 9, 2020 20:01 — forked from gbuszmicz/worker.js
Heroku worker process
const amqp = require('amqp-connection-manager')
const AMQP_URL = process.env.CLOUDAMQP_URL || 'amqp://localhost';
if (!AMQP_URL) process.exit(1)
const WORKER_QUEUE = 'worker-queue'
// Create a new connection manager from AMQP
var connection = amqp.connect([AMQP_URL])
@devloic
devloic / clock.js
Created June 9, 2020 20:01 — forked from gbuszmicz/clock.js
Heroku clock.js process
const CronJob = require('cron').CronJob
const amqp = require('amqp-connection-manager')
const AMQP_URL = process.env.CLOUDAMQP_URL || 'amqp://localhost';
if (!AMQP_URL) process.exit(1)
const WORKER_QUEUE = 'worker-queue' // To consume from worker process
const CLOCK_QUEUE = 'clock-queue' // To consume from clock process
const JOBS = [{ // You could store these jobs in a database
name: "Cron process 1",
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}