New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cunic

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

cunic

rabbitmq api wrapper

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by20%
Maintainers
1
Weekly downloads
 
Created
Source

Cunic

This is a simple rabbitmq wrapper with specific messaging patterns, pubsub and rpc.

npm install cunic

Getting Started

import Cunic from 'cunic';

const cunic = new Cunic();

cunic.connect().then(async () => {
  const pubsub = await cunic.createPubSub();

  /* subscribe to an amqp exchange */
  await pubsub.subscribe('api.account.create', (message) => { console.log(`pubsub: received ${message}`); });


  /* publish to an amqp exchange */
  await pubsub.publish('api.account.create', () => ({ message: 'ping' }));
});

The API is simple, this is an ongoing experiment, and usage is simple as well.

API

Cunic()

The constructor accepts a single parameter, hostname. Default value is amqp://localhost.

Cunic.connect()

Initializes the connection and channel.

Cunic.disconnect()

Closes the connection and channel.

PubSub

Amqp wrapper for the Pub/Sub pattern.

PubSub.subscribe()

Subscribe to an exchange using the string input as exchange name.

PubSub.publish()

Publish to the exchange using the string input as exchange name, all subscribers will receive the message.

RPC

Amqp wrapper for the RPC pattern.

RPC.serve()

RPC Queue server using the string input as queue name. Each queue server has its dedicated queue.

RPC.call()

Calls a remote procedure using the string input as queue name.

Keywords

FAQs

Package last updated on 07 Dec 2019

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