npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rmq-proxy

v1.0.0

Published

Send HTTP(S) requests through a RabbitMQ exchange/queue to one or more HTTP servers as a proxy to enable controlled request consumption

Downloads

4

Readme

rmq-proxy

Send HTTP requests through a RabbitMQ exchange/queue to one or more HTTP servers as a proxy to enable controlled request consumption

Usage

  // on the app that is receiving messages
  const connection = createRabbitMQConnection();
  const { receiver } = require('rmq-proxy');
  const closeReceiver = receiver({ connection, domains: ['my.domain.com'] });



  // on app that is sending messages to the receiver application
  const connection = createRabbitMQConnection();
  const { sender } = require('rmq-proxy');
  const { adapter } = await sender({ connection });
  const axios = require('axios');

  const response = await axios.get({ url: 'https://my.domain.com/something', adapter });
  // request used the RMQ exchange and queues instead of HTTP

Methods

sender

Returns an object with two properties adapter and shutdown.

  • appId = The identifier of the app, default: random uuid
  • connection = Instance of amqplib.connect, optional
  • connectionOptions = Optional way to specify amqplib.connect options
  • exchange = The name of the exchange that is used to route messages to the domain queues created by the receiver method, defaults to 'http.proxy'.
  • exchangeOptions = The options used to assert the exchange into existence, see available options, defaults to { durable: true }.
  • queueOptions = The options used to assert the replyTo queue into existence, see available options, defaults to { autoDelete: true, exclusive: false, durable: false, arguments: { 'x-queue-mode': 'lazy' } }.
  • replyTo = The name used to create a queue capable of receiving the response message after the receiver has processed the request, defaults to random uuid.
  • simultaneous = The number of simultaneous messages to process from the replyTo queue, defaults to 2.

receiver

Returns a function that shutsdown the rmq connection

  • appId = The identifier of the app, default: random uuid
  • connection = Instance of amqplib.connect, optional
  • connectionOptions = Optional way to specify amqplib.connect options
  • exchange = The name of the exchange that is used to route messages to the domain queues created by the receiver method, defaults to 'http.proxy'.
  • exchangeOptions = The options used to assert the exchange into existence, see available options, defaults to { durable: true }.
  • queueOptions = The options used to assert the replyTo queue into existence, see available options, defaults to { autoDelete: true, exclusive: false, durable: false, arguments: { 'x-queue-mode': 'lazy' } }.
  • domains = An array of domains or an object with domains as keys and queue options as the field values, defaults to {}
  • limit = An async function that can delay execution of newly received request messages allowing limiting of execution, defaults to async () => {}