{"_id":"@alibrate/amqp-client","_rev":"4-0c07af5bdf0d3a5463cb8f5c58c39a1d","name":"@alibrate/amqp-client","description":"Simple connector for amqp protocol","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@alibrate/amqp-client","description":"Simple connector for amqp protocol","version":"1.0.0","author":"","dependencies":{"amqplib":"^0.5.1","config":"^1.25.1","uuid":"^3.0.1"},"devDependencies":{},"main":"index.js","scripts":{},"gitHead":"b0df5123215bf44d9416cfed0b6cf78e1d43fc26","_id":"@alibrate/amqp-client@1.0.0","_shasum":"fac8765d56dc0e854c9b36c5df5634075955f6c4","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"},"dist":{"shasum":"fac8765d56dc0e854c9b36c5df5634075955f6c4","tarball":"https://registry.npmjs.org/@alibrate/amqp-client/-/amqp-client-1.0.0.tgz","integrity":"sha512-QermZ/pfkl/00DWuMvfm7neR30UdcHkms6WqkU5bP0Ru/MG2eRe6YZZt2xOErarb3NkWsdWsP7ZeLYkC78d0lA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbHn8L9XmRCub6zFStE4A+dinMIjdTUAnGQMKj8CwmTwIgOWISL++IpWtan0UrYQHuJ81qXfUgyDggRsz/wwmmbvE="}]},"maintainers":[{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amqp-client-1.0.0.tgz_1508014121854_0.3848597635515034"},"directories":{}},"1.0.1":{"name":"@alibrate/amqp-client","description":"Simple connector for amqp protocol","version":"1.0.1","author":"","dependencies":{"amqplib":"^0.5.1","config":"^1.25.1","uuid":"^3.0.1"},"devDependencies":{},"main":"index.js","scripts":{},"gitHead":"bfc380713f0f7da14cf02326b7ae6a6f96662003","_id":"@alibrate/amqp-client@1.0.1","_shasum":"99d7fa8d52fca46332aed14a429aa190bf8be9f3","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"},"dist":{"shasum":"99d7fa8d52fca46332aed14a429aa190bf8be9f3","tarball":"https://registry.npmjs.org/@alibrate/amqp-client/-/amqp-client-1.0.1.tgz","integrity":"sha512-o0wH7HU7XazPEG4KYmIA63PzR9wCf5dPbbivfBrY3qhMYJHfQMVecmI9umBZST56s3XBqXuiTPjpywotZyaltw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAHKB3IjqXkXWibqMFJkOoBpQuCyGAGCH/DVxmgRRM7QAiBy9I/ZPaSCc4iJff/muLRLvfgN6bhzJ7gqZtcbQqDlrg=="}]},"maintainers":[{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amqp-client-1.0.1.tgz_1508110144072_0.29419914237223566"},"directories":{}},"1.0.2":{"name":"@alibrate/amqp-client","description":"Simple connector for amqp protocol","version":"1.0.2","author":"","dependencies":{"amqplib":"^0.5.1","config":"^1.25.1","uuid":"^3.0.1"},"devDependencies":{},"main":"index.js","scripts":{},"gitHead":"ea82bd0bea570ea5af42a4fee7a3e7cc6202bbef","_id":"@alibrate/amqp-client@1.0.2","_shasum":"ce79e41b99d5071c64876277aaa3ae4782778cfc","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"},"dist":{"shasum":"ce79e41b99d5071c64876277aaa3ae4782778cfc","tarball":"https://registry.npmjs.org/@alibrate/amqp-client/-/amqp-client-1.0.2.tgz","fileCount":7,"unpackedSize":6702,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa72wmCRA9TVsSAnZWagAACfMP/3McVebOBfeT4tUBW+kh\nQtETWbi97CiymiOzM6QkGwVo+HLcVbSDnSK0XY0B3emI+IkfkWD1wWYoL/eq\n2S4mv6ExyKXmlK08iZUvm8X+QsF7ymsaX7kjQDxDn832jOGTo6fWe57g5pXM\n05cyOVJK/VSanObzeYWQ6oAOBt8DeJeklz1kXGggvcOm5CSBz0NLdc1DguaW\nO8i+mInUedGLUkPtRCiHjtgCDzGXDRR1Q2tr1yKZ0RVBou94xSEHFV4cG5WZ\n27mKne+L+WZGcY69HJG9MAPCEX/16l6g+88RsacXYhr8NfhPawuorxwe/rvD\nyalJrb7pvnUS4EQBHU/nhykKfPL39LsJ47bJTt3+N/IhxTh+yKBxDYaCe4eG\nQEUhaaZi985JZBj/7PcHcqEyWzRe5Upafc/tS37kEULeFVAWd5vakfuRMEhp\nU4gZmGlMJtKewbvzPQIlIP/er6fEEJXTzgIY6lzOUGmmlt0N5Ayvjv5MqUPu\n+nAJCpGunSjgWs11zmv5G5ehCvR50AIYm+BVhfb+IqRGdC08GRwHZO1cob4K\n8Slr8SvRppwi81iCO3hivpyVibjQgLjp+k2qyMxzMw7fcw05f+jIvI0u4rWh\nIhiP8ep/yetkz6CPLfiyLWQaLc+hzbkIlOwFkpy948nKqRySia6qTIhV1cSi\nLxFD\r\n=+vet\r\n-----END PGP SIGNATURE-----\r\n","integrity":"sha512-EvNCqOhcqbuIRolgRmzNY/RDiLGVcDp+focSGa3aBkjLMnayJNAUuzS6LFWJauy6fZEmNdBa7eg+0wCLumOBWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD654VXF6Yf7NkdQSYWCbz+uoplO98/d3ZUrog5/DKoSwIhAK8ico0zUVeGgvwM2Lx63yUKKQd7mOQsxMrNdDrd0/ER"}]},"maintainers":[{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/amqp-client_1.0.2_1525640229083_0.678703861159748"},"_hasShrinkwrap":false}},"readme":"# AMQP client library\n\nHigh level amqp API written on top of [amqplib](https://github.com/squaremo/amqp.node)\n\n## Install\n```\nnpm install\n```\n## use\n\n```js\n\nconst pubsub = require('amqp-client').pubsub;\n\n```\n\n## Publish and Suscribe\nSet of functions that implement Publish and Suscribe pattern.\n\n### Publishing\n\nThe Publisher side looks like this:\n```js\nconst pubsub = require('amqp-client').pubsub;\n\nconst msg = {foo: 'bar'};\n\npubsub.startExchange({url: amqpServerURL, name: 'myexchange'}).then(function (ch) {\n\tpubsub.publish(ch, 'myfilter', msg);\n});\n\n```\npubsub.startExchange() takes an object with the following properties\n* `url` : amqp server url. Default: `amqp://localhost`;  often config.amqp.url or context.config.amqp.url\n* `name` : Name for your exchange, an exchange is like a gateway, so be sure consumers & producers share the same exchange name\n* `type` : Exchange type. Can be: 'direct', 'topic', 'headers', 'fanout'. See amqplib documentation for more information about all the types. Default: `direct`\n* `options` : Options object for internal `assertExchange` method. See amqplib documentation.\n\n\npubsub.publish()\n* `ch` : the channel returned from startExchange that is used to dispatch messages\n* `'myfilter'` : the string filter used for sending messages, consumers must use the same filter to receive\n* `msg` : the message to pass along to consumers\n\n### Suscribers\n\nThe Consumer side looks like this:\n\n```js\nconst pubsub = require('amqp-client').pubsub;\n\nfunction onMsg(message){\n\tconsole.log(\"Received message:\", message);\n\tlet publisherMessage = JSON.parse(message.content);\n\tconsole.log(\"Received content from publisher:\", publisherMessage);\n}\n\npubsub.startExchange({url: amqpServerURL, name: 'myexchange'}).then(function (ch) {\n\tpubsub.consume(ch, 'optional_group', ['myfilter', 'otherFilter'], onMsg);\n});\n```\n\nThe callback parameter is not the message that was sent from the publisher.  Rather it is the actual AMQP message that contains both the stringified version of the message that the producer sent and a whole lot of other information.  The actual message sent by the producer is contained in message.content\n\nThe consumer open the same exchange `myexchange` using the same promise `startExchange()` and then listen for new messages with specific filters.\nThat meeans all the messages sended to myexchange with that filters will be received for this consumer.\nNote the `optional_group` parameter. This parameter is used to balance messages between consumers that are using the same group name. That means only one consumer in the same group will receive the message each time like round-robin algorithm.\nIf you use empty string `''` as group name then the system will create a random name for you.\n","maintainers":[{"name":"alibrate-npm","email":"oscar.lopez@alibrate.com"}],"time":{"modified":"2022-06-12T14:30:32.415Z","created":"2017-10-14T20:48:41.976Z","1.0.0":"2017-10-14T20:48:41.976Z","1.0.1":"2017-10-15T23:29:04.202Z","1.0.2":"2018-05-06T20:57:09.171Z"},"readmeFilename":"README.md"}