README.md in smart-que-0.2.5 vs README.md in smart-que-0.2.6

- old
+ new

@@ -6,20 +6,20 @@ ## Installation Add this line to your application's Gemfile: ```ruby -gem 'smart-que', '~> 0.2.0' +gem 'smart-que', '~> 0.2.6' ``` And then execute: $ bundle Or install it yourself as: - $ gem install smart-que -v 0.2.0 + $ gem install smart-que -v 0.2.6 ## Usage 1. Setup [RabbitMq](https://www.rabbitmq.com/#getstarted) 2. Add `smart-que` gem to your Gemfile and perform bundle install @@ -32,10 +32,11 @@ server. All messages are converted to JSON format before publishing to the queue. RabbitMq server details and queue lists can be configured as follows ``` # File: config/initializers/smart_que.rb +require 'smart_que' SmartQue.configure do |f| f.host = ENV[:rabbit_mq][:host'] f.port = ENV[:rabbit_mq][:port'] f.vhost = ENV[:rabbit_mq][:vhost'] @@ -71,11 +72,11 @@ $publisher.unicast(queue_name, payload) ``` The `unicast` method will provide an option to publish message to any queue which are not predefined with initialization configuration. The `queue_name` parameter can be any queue -name, which will be created and bind to direct exchange instantly if doesn't exist. +name, which will be created and bound to direct exchange instantly if doesn't exist. ``` $publisher.unicast('sms_alert', { number: '+919898123123', message: 'Test Message' }) ``` @@ -94,11 +95,25 @@ ``` $publisher.multicast('weather', { message: 'Test Message' }) ``` +## SmartQue broadcast +``` +$publisher.broadcast(payload) +``` + +The `broadcast` method will provide an option to broadcast message to queues which are +not predefined with initialization configuration. The broadcst message will be consumable by +all queues which are bound to rabbitmq fanout exchange. + +``` +$publisher.broadcast({ message: 'Broadcast Test Message' }) +``` + + ## SmartQue Consumer The consumer class should be inherited from SmartQue::Consumer, and each consumer will be listening to a defined Queue. The queue name and `run` method should be defined properly in each consumer class. @@ -140,9 +155,15 @@ end # Task can be initiated by rake RAILS_ENV=staging bundle exec rake rabbitmq:send_otp_sms ``` + +## SmartQue Exceptions + +SmartQue will not retry automatic connection recovery after rabbitmq connection failure. It raises +`SmartQue::ConnectionError` when tcp connection failure happens. You can catch this exception to +identify connection failures and can perform necessary actions upon it. ## RabbitMq Web Interface You can enable rabbitmq_management plugin so that rabbitmq server informations are viewed and managed via web console interface. Management plugin can be enabled