Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hapi-amqp

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hapi-amqp

AMQP plugin for HapiJS

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

hapi-amqp

This library is a hapi plugin for amqplib.

wercker status

API

  • connection - The amqplib connection object
  • createChannel(connection, cb)
  • createConfirmChannel(connection, cb)

Both of the channel objects call the callback (cb) with err, channel as arguments.

The connection is established once and is reused between requests.

It passes the options provided directly to amqplib, with the exception of the api argument which can be 'promise' which will use the promise based API for amqplib instead of the callback one.

Example

amqp.createConfirmChannel(amqp.connection, function (err, channel) {
  if (err) {
    reply('couldnt create channel');
    return;
  }

  channel.assertQueue(queueName, {durable: true}, function (queueErr, ok) {
    if (queueErr || !ok) {
      reply('Err: ' + queueErr + ' ok? ' + ok);
      return;
    }

    channel.sendToQueue(queueName, new Buffer(JSON.stringify({foo: 'bar'})), {mandatory: true, persistent: true}, function (publishErr) {
      channel.close(function () {
        if (publishErr) {
          reply(publishErr);
          return;
        }

        reply(null, 'worked.');
      });
    });
  });
});

Keywords

FAQs

Package last updated on 22 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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