Socket
Socket
Sign inDemoInstall

amqplib-easy

Package Overview
Dependencies
Maintainers
33
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amqplib-easy - npm Package Compare versions

Comparing version 4.5.0 to 5.0.0

18

API.md

@@ -67,3 +67,19 @@ - [`Create(amqpUrl)`](#createamqpurl-socketoptions---amqp)

Defaults to an empty object
- `parse`: (function) parse string content of message. Defaults to `JSON.parse`
- `parse`: (function) a function which accepts raw message as an argument and returns decoded message content.
Defaults to `jsonDecoder` which simply converts json encoded message content to `Object` by calling `JSON.parse`.
The raw message passed as an argument have the following properties:
```javascript
{
content: Buffer,
fields: Object,
properties: Object
}
```
See
[amqplib.channelConsume](http://www.squaremobius.net/amqp.node/channel_api.html#channel_consume)
for more information.
- `prefetch`: (number) of messages to fetch when consuming. Defaults to `1`

@@ -70,0 +86,0 @@ - `arguments`: (object) containing any binding arguments for the queue. Defaults to `{}`

9

index.js

@@ -37,2 +37,7 @@ 'use strict'

function jsonDecoder (message) {
if (!(message && message.content)) return null
return JSON.parse(message.content.toString())
}
diehard.register(cleanup)

@@ -82,3 +87,3 @@

exchangeOptions: {durable: true},
parse: JSON.parse,
parse: jsonDecoder,
queueOptions: {durable: true},

@@ -125,3 +130,3 @@ prefetch: 1,

try {
msg.json = options.parse(msg.content.toString())
msg.payload = msg.json = options.parse(msg)
return handler(msg, ch)

@@ -128,0 +133,0 @@ } catch (err) {

{
"name": "amqplib-easy",
"version": "4.5.0",
"version": "5.0.0",
"description": "Simplified API for interacting with AMQP",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -55,4 +55,7 @@ /* globals it:false */

var name = cat.json.name
var payload = cat.payload
try {
cat.should.have.properties(['content', 'fields', 'properties'])
name.should.equal('Fred')
payload.should.be.deepEqual(cat.json)
done()

@@ -59,0 +62,0 @@ } catch (err) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc