rabbitmessaging v0.1.0
rabbitmessaging
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,subscribeandpublish
__connection:
Create a new amqp connection which will connect to provided url in following structure:
url: 'amqp://' + rabbitmq.username + ':' + rabbitmq.password + '@' + rabbitmq.host + ':' + rabbitmq.portOptions:
url- URL to the serverDefault: falseprefetch- Number of channels allowed in a single connectionDefault: 10heartbeat- number of sec after which server send back a connection alive heartbeat else throws an errorDefault: 10reconnectTimeout- Timeout before trying to reconnect to the serverDefault: 10000debug- debug the outputDefault: falseconn- Connection objectDefault: falsemaxRetry- number times the rabbit connection retry after failure. that calculate to 10 mins of retry before service failsDefault: 60xMessageTtl- Time to live for a return queueDefault: 60000xExpires- Expiry time for for a queueDefault: 60000XMaxPriority- Priority for this queueDefault: 10noAck- if true, the broker won't expect an acknowledgement of messages delivered to this consumerDefault: falsech- channelDefault: falsecaOptions- 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
9 years ago