amqp = require "amqp"
options =
host: "localhost"
con = amqp.createConnection options
# 準備OK
con.on "ready", =>
# キューに接続
con.queue "tasklist", (q) =>
# キューからデータを取得
q.subscribe (message) =>
console.log "### task", JSON.parse message.task
# 終了
con.disconnect()
# 送信データ
task =
title: "write some articles"
time: "12:00"
estimate: "1h"
description: "brabrabra"
# キューにデータをプット
con.publish "tasklist", task: JSON.stringify task
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme