mirror of
https://github.com/ditkrg/rabbit_carrots.git
synced 2026-01-22 22:06:40 +00:00
Updates README
This commit is contained in:
parent
a51eed8101
commit
ef60e8342d
17
README.md
17
README.md
@ -33,6 +33,9 @@ RabbitCarrots.configure do |c|
|
||||
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' }
|
||||
@ -41,8 +44,6 @@ end
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
Note that handler is a class that must implement a method named ```handle!``` that takes 4 parameters as follow:
|
||||
|
||||
```ruby
|
||||
@ -53,8 +54,6 @@ class DummyEventHandler
|
||||
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.
|
||||
@ -65,8 +64,16 @@ Note: Any other unrescued exception raised inside ```handle!``` the that is a su
|
||||
|
||||
### 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.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user