{"name":"amqplib","homepage":"http://squaremo.github.io/amqp.node/","main":"./channel_api.js","version":"0.3.2","description":"An AMQP 0-9-1 (e.g., RabbitMQ) library and client.","repository":{"type":"git","url":"https://github.com/squaremo/amqp.node.git"},"engines":{"node":">=0.8 <0.13 || ^1"},"dependencies":{"bitsyntax":"~0.0.4","buffer-more-ints":"0.0.2","readable-stream":"1.x >=1.1.9","when":"~3.6.2"},"devDependencies":{"mocha":"~1","claire":"0.4.1","uglify-js":"2.4.x","istanbul":"0.1.x"},"scripts":{"test":"make test","prepublish":"make"},"keywords":["AMQP","AMQP 0-9-1","RabbitMQ"],"author":{"name":"Michael Bridgen","email":"mikeb@squaremobius.net"},"license":"MIT","gitHead":"93fde0fe29e3fca2b91743b1a63a81ce291effc9","bugs":{"url":"https://github.com/squaremo/amqp.node/issues"},"_id":"amqplib@0.3.2","_shasum":"e77d8fb3842ebcae78cf1c930c490d1e954f4297","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"squaremo","email":"mikeb@squaremobius.net"},"maintainers":[{"name":"squaremo","email":"mikeb@squaremobius.net"}],"dist":{"shasum":"e77d8fb3842ebcae78cf1c930c490d1e954f4297","tarball":"http://registry-npm.ywwl.com/amqplib/download/amqplib-0.3.2.tgz","integrity":"sha512-WgInY2jfpTbRyJ9s9Iwy5pAfdr7z81ZqIzVwQ/2OY1Ui3xtLfXrIXyXvuwAKQqBvPqVy723Ngu6V2h4EGDTX6w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAh9PnA5QIBx2GHQj5E7OL8kkmJhg6IXnn9kxpRYL+7GAiEAmuBDlyXZ7ZCLNtcw/Tsk/A9oDa+fmzEtUqlq2TJC+RI="}],"size":68108,"noattachment":false,"key":"/amqplib/-/amqplib-0.3.2.tgz"},"directories":{},"readme":"# AMQP 0-9-1 library and client for Node.JS\n\n[![NPM version](https://img.shields.io/npm/v/amqplib.svg?style=flat-square)](https://www.npmjs.com/package/amqplib)\n[![NPM downloads](https://img.shields.io/npm/dm/amqplib.svg?style=flat-square)](https://www.npmjs.com/package/amqplib)\n[![Node.js CI](https://github.com/amqp-node/amqplib/workflows/Node.js%20CI/badge.svg)](https://github.com/amqp-node/amqplib/actions?query=workflow%3A%22Node.js+CI%22)\n[![amqplib](https://snyk.io/advisor/npm-package/amqplib/badge.svg)](https://snyk.io/advisor/npm-package/amqplib)\n\n    npm install amqplib\n\n * [Change log][changelog]\n * [GitHub pages][gh-pages]\n * [API reference][gh-pages-apiref]\n * [Troubleshooting][gh-pages-trouble]\n * [Examples from RabbitMQ tutorials][tutes]\n\n\nA library for making AMQP 0-9-1 clients for Node.JS, and an AMQP 0-9-1 client for Node.JS v10+.\n\nThis library does not implement [AMQP\n1.0](https://github.com/squaremo/amqp.node/issues/63) or [AMQP\n0-10](https://github.com/squaremo/amqp.node/issues/94).\n\nProject status:\n\n - Expected to work\n - Complete high-level and low-level APIs (i.e., all bits of the protocol)\n - Stable APIs\n - A fair few tests\n - Measured test coverage\n - Ports of the [RabbitMQ tutorials][rabbitmq-tutes] as [examples][tutes]\n - Used in production\n\nStill working on:\n\n - Getting to 100% (or very close to 100%) test coverage\n\n## Callback API example\n\n```javascript\nconst amqplib = require('amqplib/callback_api');\nconst queue = 'tasks';\n\namqplib.connect('amqp://localhost', (err, conn) => {\n  if (err) throw err;\n\n  // Listener\n  conn.createChannel((err, ch2) => {\n    if (err) throw err;\n\n    ch2.assertQueue(queue);\n\n    ch2.consume(queue, (msg) => {\n      if (msg !== null) {\n        console.log(msg.content.toString());\n        ch2.ack(msg);\n      } else {\n        console.log('Consumer cancelled by server');\n      }\n    });\n  });\n\n  // Sender\n  conn.createChannel((err, ch1) => {\n    if (err) throw err;\n\n    ch1.assertQueue(queue);\n\n    setInterval(() => {\n      ch1.sendToQueue(queue, Buffer.from('something to do'));\n    }, 1000);\n  });\n});\n```\n\n## Promise/Async API example\n\n```javascript\nconst amqplib = require('amqplib');\n\n(async () => {\n  const queue = 'tasks';\n  const conn = await amqplib.connect('amqp://localhost');\n\n  const ch1 = await conn.createChannel();\n  await ch1.assertQueue(queue);\n\n  // Listener\n  ch1.consume(queue, (msg) => {\n    if (msg !== null) {\n      console.log('Received:', msg.content.toString());\n      ch1.ack(msg);\n    } else {\n      console.log('Consumer cancelled by server');\n    }\n  });\n\n  // Sender\n  const ch2 = await conn.createChannel();\n\n  setInterval(() => {\n    ch2.sendToQueue(queue, Buffer.from('something to do'));\n  }, 1000);\n})();\n\n```\n\n## Running tests\n\n    npm test\n\nTo run the tests RabbitMQ is required. Either install it with your package\nmanager, or use [docker][] to run a RabbitMQ instance.\n\n    docker run -d --name amqp.test -p 5672:5672 rabbitmq\n\nIf prefer not to run RabbitMQ locally it is also possible to use a\ninstance of RabbitMQ hosted elsewhere. Use the `URL` environment\nvariable to configure a different amqp host to connect to. You may\nalso need to do this if docker is not on localhost; e.g., if it's\nrunning in docker-machine.\n\nOne public host is dev.rabbitmq.com:\n\n    URL=amqp://dev.rabbitmq.com npm test\n\n**NB** You may experience test failures due to timeouts if using the\ndev.rabbitmq.com instance.\n\nYou can run it under different versions of Node.JS using [nave][]:\n\n    nave use 10 npm test\n\nor run the tests on all supported versions of Node.JS in one go:\n\n    make test-all-nodejs\n\n(which also needs `nave` installed, of course).\n\nLastly, setting the environment variable `LOG_ERRORS` will cause the\ntests to output error messages encountered, to the console; this is\nreally only useful for checking the kind and formatting of the errors.\n\n    LOG_ERRORS=true npm test\n\n## Test coverage\n\n    make coverage\n    open file://`pwd`/coverage/lcov-report/index.html\n\n[gh-pages]: https://amqp-node.github.io/amqplib/\n[gh-pages-apiref]: https://amqp-node.github.io/amqplib/channel_api.html\n[gh-pages-trouble]: https://amqp-node.github.io/amqplib/#troubleshooting\n[nave]: https://github.com/isaacs/nave\n[tutes]: https://github.com/amqp-node/amqplib/tree/main/examples/tutorials\n[rabbitmq-tutes]: http://www.rabbitmq.com/getstarted.html\n[changelog]: https://github.com/amqp-node/amqplib/blob/main/CHANGELOG.md\n[docker]: https://www.docker.com/\n","publish_time":1427276791019,"_cnpm_publish_time":1427276791019,"dist-tags":{"latest":"2.2.1"}}