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

amqpr

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

amqpr

A simple and elegant AMQP client

  • 0.1.2
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

amqpr

A simple and elegant AMQP client written by TypeScript

Inspired by amqp-ts

Usage

An example

import * as amqp from 'amqpr';
// const amqp = require("amqpr"); // js require

async function run() {
  const connection = new amqp.Connection('amqp://localhost');
  const exchange = connection.declareExchange('ExchangeName');
  const queue = connection.declareQueue('QueueName');
  await queue.bind(exchange);
  await queue.consume(message => {
    console.log('Message received: ' + message.getContent());
  });

  // it is possible that the following message is not received because
  // it can be sent before the queue, binding or consumer exist
  const msg = new amqp.Message('Test');
  exchange.send(msg);

  await connection.ready();

  // the following message will be received because
  // everything you defined earlier for this connection now exists
  const msg2 = new amqp.Message('Test2');
  exchange.send(msg2);
}

run().catch(console.error);

More examples can be found in the tutorials directory.

Connection Status

  • connection.connected: Returns true if the connection exists and false, otherwise.
  • connection.online(): Resolved when connected.
  • connection.ready(): Resolved when connected and all resources(actors) has been ready.

Events

All events from connback

Automatic Reconnection

When the library detects that the connection with the AMQP server is lost, it tries to automatically reconnect to the server.

It is powered by connback.

Roadmap

  • Better documentation

FAQs

Package last updated on 20 Jan 2022

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