README.md in outboxable-1.0.2 vs README.md in outboxable-1.0.3

- old
+ new

@@ -1,8 +1,8 @@ # Outboxable -The Outboxable Gem is tailored for Rails applications to implement the transactional outbox pattern. It currently only supports ActiveRecord. +The Outboxable Gem is tailored for Rails applications to implement the transactional outbox pattern. It supports both ActiveRecord and Mongoid. Please take into consideration that this Gem is **opinionated**, meaning it expects you to follow a certain pattern and specific setting. If you don't like it, you can always fork it and change it. ### Restrictions @@ -23,19 +23,25 @@ ```ruby $ gem install outboxable ``` -Then run: +For use with ActiveRecord, run: ```shell -$ rails g outboxable:install +$ rails g outboxable:install --orm activerecord ``` -The command above will add a migration file and the Outbox model. You will need then to run the migrations: +For use with Mongoid, run: ```shell +$ rails g outboxable:install --orm mongoid +``` + +The command above will add a migration file and the Outbox model. You will need then to run the migrations (ActiveRecord only): + +```shell $ rails db:migrate ``` ## Usage @@ -62,11 +68,11 @@ end end end Outboxable.configure do |config| - # Specify the ORM you are using. For now, only ActiveRecord is supported. + # Specify the ORM you are using. Supported values are :activerecord and :mongoid config.orm = :activerecord # Specify the message broker you are using. For now, only RabbitMQ is supported. config.message_broker = :rabbitmq @@ -205,9 +211,15 @@ Last but not least, run sidekiq so that the Outboxable Gem can publish the events to the broker: ```shell $ bundle exec sidekiq ``` + + + +### Mongoid + +The Outboxable gem works smoothly with Mongoid. It is to be noted that when used with Mongoid, Outboxable does not use the `_id` as the idempotency key. It creates a field called ``idempotency_key`` which is a UUID generated at the time of the insertion of the document. ## 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.