Giter Site home page Giter Site logo

kffl / fastify-amqp-async Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 135 KB

:zap::rabbit: Fastify AMQP plugin with modern Promise-based API based on amqplib-as-promised

License: MIT License

JavaScript 80.45% TypeScript 19.55%
amqp async-await fastify fastify-amqp fastify-plugin fastify-plugins fastify-rabbitmq rabbitmq

fastify-amqp-async's People

Contributors

dependabot[bot] avatar kffl avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

noobskywalker

fastify-amqp-async's Issues

confirmChannel typing issues

When accessing amqp.confirmChannel, IDE type hints are not working properly (all of its methods are assumed to be of type any). After installing @types/amqplib, it turns out that confirmChannel is of native amqplib's type ConfirmChannel and not that of amqplib-as-promised (which wraps the native ConfirmChannel in order to expose promise-based API). This problem doesn't break anything at runtime, since Connection.createChannel() returns an object with the desired prototype (despite wrong type info).

That behavior is caused by amqplib-as-promised exporting the native ConfirmChannel instead of the wrapped one.

Introduce an option to opt-out of the default onClose behavior

As of now, the plugin provides a basic onClose handler which closes the AMQP connection when the Fastify instance closes. It might be beneficial to allow the user to opt-out of such behavior and provide custom logic in onClose (i.e. waiting for in-flight messages to be delivered before terminating the AMQP connection).

Add logging

Logging via a FastifyInstance's child logger could be added for easier debugging. Logs could be printed when the following events occur:

  • connection is opened
  • channel is created
  • connection is closed

Security vulnerabilities of transitive dependencies (amqplib, url-parse)

As of now, there is a known vulnerability in url-parse used by amqplib, which is a dependency of amqplib-as-promised. Since amqplib-as-promised uses a rather old version 0.5.5 of amqplib there are two less severe vulnerabilities as well. These can be temporarily fixed using npm-force-resolutions until the top-level dependencies update their sub-dependencies as needed.

Release v1 to indicate stable API

Version 1 could be released in order to allow for updates within a major version when a dependency is declared with a caret symbol.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.