Skip to content
master
Switch branches/tags
Code

Latest commit

Bumps [tsd](https://github.com/SamVerschueren/tsd) from 0.17.0 to 0.18.0.
- [Release notes](https://github.com/SamVerschueren/tsd/releases)
- [Commits](SamVerschueren/tsd@v0.17.0...v0.18.0)

---
updated-dependencies:
- dependency-name: tsd
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3ceff09

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

fastify-amqp

js-standard-style CI workflow

Fastify AMQP connection plugin wrapper to amqplib, to use with RabbitMQ

Installation

This is a Node.js module available through the npm registry. It can be installed using the npm or yarn command line tools.

npm install fastify-amqp --save

Tests

npm install
npm test

Usage

const fastify = require('fastify')()

fastify.register(require('fastify-amqp'), {
  // the default value is amqp
  protocol: 'amqp',
  hostname: 'localhost',
  // the default value is 5672
  port: 5672,
  // the default value is guest
  username: 'guest',
  // the default value is guest
  password: 'guest'
  // the default value is empty
  vhost: ''
})

fastify.get('/', function (request, reply) {
  const channel = this.amqp.channel

  const queue = 'hello'
  const msg = 'Hello world'

  channel.assertQueue(queue, {
    durable: false
  })
  
  channel.sendToQueue(queue, Buffer.from(msg))
  reply.send(' [x] Sent ' + msg)
})

fastify.listen(3000, err => {
  if (err) throw err
})

Reference

This plugin is just a wrapper to amqplib.

Contains:

  • amqp.connection API to here
  • amqp.channel API to here

Dependencies

Dev Dependencies

  • fastify: Fast and low overhead web framework, for Node.js
  • pre-commit: Automatically install pre-commit hooks for your npm modules.
  • standard: JavaScript Standard Style
  • tap: A Test-Anything-Protocol library for JavaScript
  • typescript: TypeScript is a language for application scale JavaScript development

License

MIT