GitXplorerGitXplorer
R

fastify-amqp

public
23 stars
6 forks
4 issues

Commits

List of commits on branch master.
Verified
04ca61cc9d0bf95b37852f862582a838350f44a4

chore(deps-dev): bump tsd from 0.23.0 to 0.24.0 (#42)

ddependabot[bot] committed 2 years ago
Verified
b76bc2c28cba977c4c6669768f42c22463b2841d

chore(deps-dev): bump tsd from 0.22.0 to 0.23.0 (#41)

ddependabot[bot] committed 2 years ago
Verified
f30374b5d0eb9b42c68a47871536c5d3c732f8d2

chore(deps): bump fastify-plugin from 3.0.1 to 4.0.0 (#40)

ddependabot[bot] committed 3 years ago
Verified
21c74e3c148ee3735ee96077bc47034f0eb3e40e

chore(deps-dev): bump tsd from 0.21.0 to 0.22.0 (#39)

ddependabot[bot] committed 3 years ago
Unverified
bb7c17f167016f8ed34368b664a08f8d3e588e3b

1.1.0

RRafaelGSS committed 3 years ago
Verified
635e25ea231a760671afecc5c1fa6969b41ac6b3

chore(deps-dev): bump tsd from 0.20.0 to 0.21.0 (#38)

ddependabot[bot] committed 3 years ago

README

The README file for this repository.

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