@highoutput/amqp

A simplified client for ActiveMQ

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@highoutput/amqp
690.11.303 months ago3 years agoMinified + gzip package size for @highoutput/amqp in KB

Readme

amqp
A simplified abstraction of the AMQP 1.0 protocol

Usage

RPC

import Amqp from '@highoutput/amqp';
import assert from 'assert';

async function main() {
  const amqp = new Amqp();

  await amqp.createWorker(
    'queue',
    async message => message
  );
  const client = await amqp.createClient('queue');

  const result = await client('Hello World!');
  assert.equal(result, 'Hello World!');
}

main();

PubSub

import Amqp from '@highoutput/amqp';
import assert from 'assert';

async function main() {
  const amqp = new Amqp();

  await amqp.createSubscriber(
    'topic.*',
    async message => assert.equal(message, 'Hello World!')
  );

  const publish = await amqp.createPublisher('topic.hello');
  publish('Hello World!');
}

main();