1.0.0 • Published 10 months ago

@onesy/amqp v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Getting started

Add

yarn add @onesy/amqp

Add amqplib peer dependency.

yarn add amqplib

Use

  import OnesyAmqp from '@onesy/amqp';
  // Make if you wanna a config file and
  // inside of it add all the process.env related props
  import Config from './config';

  // Make a new amqp instance
  const onesyAmqp = new OnesyAmqp({
    uri: Config.amqp.rabbitmq.uri,
    queues: Config.amqp.rabbitmq.queues,
    exchanges: Config.amqp.rabbitmq.exchanges,
  });

  // Await for a channel
  await onesyAmqp.channel;

  // Send to a queue
  await onesyAmqp.send('a', 'a');

  // Check a queue
  await onesyAmqp.checkQueue();

  // { queue: 'a', messageCount: 1, etc. }

Dev

Install

yarn

Test

yarn test

One time local setup

Install docker and docker-compose

Make docker containers

yarn docker

Prod

Build

yarn build