Socket
Socket
Sign inDemoInstall

amqp-service

Package Overview
Dependencies
21
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    amqp-service

AMQP client


Version published
Weekly downloads
7
increased by250%
Maintainers
1
Install size
1.70 MB
Created
Weekly downloads
 

Readme

Source

AMQP Service

| Download only 1.2.0+ versions only, cause lower versions contain bugs

AMQP service which can fetch and send messages to queues

Usage

Config

# Advanced Message Queue Protocol settings
amqp:
  # AMQP Server settings
  # You can read more about this settings [here](http://www.squaremobius.net/amqp.node/channel_api.html#connect)
  server:
    protocol: 'amqp'
    hostname: 'localhost'
    port: 5672
    username: 'guest'
    password: 'guest'
    vhost: '/'
    locale: 'en_US'
    frameMax: 0
    heartbeat: 60
  # The Queues which will be added to program
  # Note that you can change only value of this keys, cause keys are hardcoded in code
  queues:
    # Name of the Queue
    # Params of the Queue
    # You can read more about this params [here](http://www.squaremobius.net/amqp.node/channel_api.html#channel_assertQueue)
    # Event that triggers when consumer receive msg from this queue
    # Your event handler will receive deserialized and parsed msg
    - name: 'first_queue'
      params:
        durable: false
      event: 'on_amqp_first_queue'
    - name: 'second_queue'
      params:
        durable: false
      event: 'on_amqp_second_queue'

Code in project

const amqpService = new AMQPService(
    config.get('amqp.server'),
    config.get('amqp.queues')
);

await amqpService.start();
// If you want to stop AMQP Service use `amqpService.stop()`

// If you want to send Message to queue:
await amqpService.sendMessage('first_queue', {
    hello: 'world'
});

// If you want to handle messages from queue:
amqpService.on('on_amqp_first_queue', msg => {
    ...
});

Keywords

FAQs

Last updated on 05 Mar 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc