deepaknverma / rabbitmessaging

node library to handle complex RabbitMQ actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rabbitmessaging

Build Status

Node promise library to handle complex RabbitMQ actions.

Overview:


Microservices are small programs to handle single task form a complete process chain. The right pattern of communication between microservices is the key to scale your application and solve most of the distributed system problems. RabbitMQ provide a event driven approach to send messages to each other in a Microservice architecture.

For More info of RabbitMQ see:

https://www.rabbitmq.com/ http://howtocookmicroservices.com/communication/ http://blog.runnable.com/post/150022242931/event-driven-microservices-using-rabbitmq

This library provide a simple wrapper on amqp to interact with Rabbit using following approach:

  • Broker
  • Publisher
  • Subscriber

Features:


  • Automatically try to reconnect 60 times (configurable) at 1 second apart if broker dies
  • Round-robin connection between multiple brokers in a cluster
  • Handles messages in memory
  • TLS encryption support
  • Provide option to rpc, send, listen, subscribe and publish

__connection:


Create a new amqp connection which will connect to provided url in following structure:

	url: 'amqp://' + rabbitmq.username + ':' + rabbitmq.password + '@' + rabbitmq.host + ':' + rabbitmq.port

Options:

  • url - URL to the server Default: false
  • prefetch - Number of channels allowed in a single connection Default: 10
  • heartbeat - number of sec after which server send back a connection alive heartbeat else throws an error Default: 10
  • reconnectTimeout - Timeout before trying to reconnect to the server Default: 10000
  • debug - debug the output Default: false
  • conn - Connection object Default: false
  • maxRetry - number times the rabbit connection retry after failure. that calculate to 10 mins of retry before service fails Default: 60
  • xMessageTtl - Time to live for a return queue Default: 60000
  • xExpires - Expiry time for for a queue Default: 60000
  • XMaxPriority - Priority for this queue Default: 10
  • noAck - if true, the broker won't expect an acknowledgement of messages delivered to this consumer Default: false
  • ch - channel Default: false
  • caOptions - socket Options for TLS encryption. default: undefined
    • cert - client cert
    • key - client key
    • passphrase - passphrase for key
    • ca - array of trusted CA certs
    • clientProperties - user defined properties { IP: 127.0.0.1 }

Examples: see GITHUB

About

node library to handle complex RabbitMQ actions

License:MIT License


Languages

Language:JavaScript 100.0%