README.md in rabbit_carrots-0.1.20 vs README.md in rabbit_carrots-1.0.0
- old
+ new
@@ -31,43 +31,50 @@
c.rabbitmq_port = ENV.fetch('RABBITMQ__PORT', nil)
c.rabbitmq_user = ENV.fetch('RABBITMQ__USER', nil)
c.rabbitmq_password = ENV.fetch('RABBITMQ__PASSWORD', nil)
c.rabbitmq_vhost = ENV.fetch('RABBITMQ__VHOST', nil)
c.rabbitmq_exchange_name = ENV.fetch('RABBITMQ__EXCHANGE_NAME', nil)
+ c.automatically_recover = true
+ c.network_recovery_interval = 5
+ c.recovery_attempts = 5
c.routing_key_mappings = [
{ routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' },
{ routing_keys: ['RK1', 'RK2'], queue: 'QUEUE_NAME', handler: 'CLASS HANDLER IN STRING' }
]
end
```
-
-
Note that handler is a class that must implement a method named ```handle!``` that takes 4 parameters as follow:
```ruby
class DummyEventHandler
def self.handle!(channel, delivery_info, properties, payload)
# Handle the received message from the queue
end
end
```
-
-
Inside the handle message, you can NACK the message without re-queuing by raising ```RabbitCarrots::EventHandlers::Errors::NackMessage``` exception.
To NACK and re-queue, raise ```RabbitCarrots::EventHandlers::Errors::NackAndRequeueMessage``` exception.
If no errors are thrown, the message will be acknowledged soon after the ```handle!``` method returns.
Note: Any other unrescued exception raised inside ```handle!``` the that is a subclass of ```StandardError``` will trigger a NACK and re-queue.
### Running
-Then run ```bundle exec rake rabbit_carrots:eat```.
+For better scalability and improved performance, you can run rabbit_carrots in standalone mode by invoking the following command:
+```bundle exec rake rabbit_carrots:eat```.
+#### Puma
+
+For small and medium sized projects, you can delegate the management of the rabbit_carrots to the Puma web server. To achieve that, add the following line to your puma.rb
+
+```plugin :rabbit_carrots```
+
+This will make sure that Puma will manage rabbit carrots as a background service and will gracefully terminate if rabbit_carrots eventually loses connection after multiple automatic recovery.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).