Updates documentation

This commit is contained in:
Brusk Awat 2023-04-14 04:18:16 +03:00
parent 92ee8d2eea
commit 3b545b0676
Signed by: broosk1993
GPG Key ID: 5D20F7E02649F74E
5 changed files with 21 additions and 9 deletions

View File

@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
outboxable (1.0.2) outboxable (1.0.3)
bunny (>= 2.19.0) bunny (>= 2.19.0)
connection_pool (~> 2.3.0) connection_pool (~> 2.3.0)

View File

@ -1,6 +1,6 @@
# Outboxable # 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. 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.
@ -25,13 +25,19 @@ If bundler is not being used to manage dependencies, install the gem by executin
$ gem install outboxable $ gem install outboxable
``` ```
Then run: For use with ActiveRecord, run:
```shell ```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 ```shell
$ rails db:migrate $ rails db:migrate
@ -64,7 +70,7 @@ module Outboxable
end end
Outboxable.configure do |config| 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 config.orm = :activerecord
# Specify the message broker you are using. For now, only RabbitMQ is supported. # Specify the message broker you are using. For now, only RabbitMQ is supported.
@ -208,6 +214,12 @@ Last but not least, run sidekiq so that the Outboxable Gem can publish the event
$ bundle exec sidekiq $ 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 ## 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. 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.

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Outboxable module Outboxable
VERSION = '1.0.2' VERSION = '1.0.3'
end end

View File

@ -23,7 +23,7 @@ Outboxable.configure do |config|
# Specify the ORM you are using. For now, only ActiveRecord is supported. # Specify the ORM you are using. For now, only ActiveRecord is supported.
config.orm = :activerecord config.orm = :activerecord
# Specify the message broker you are using. For now, only RabbitMQ is supported. # Specify the ORM you are using. Supported values are :activerecord and :mongoid
config.message_broker = :rabbitmq config.message_broker = :rabbitmq
# RabbitMQ configurations # RabbitMQ configurations

View File

@ -23,7 +23,7 @@ Outboxable.configure do |config|
# Specify the ORM you are using. For now, only ActiveRecord is supported. # Specify the ORM you are using. For now, only ActiveRecord is supported.
config.orm = :mongoid config.orm = :mongoid
# Specify the message broker you are using. For now, only RabbitMQ is supported. # Specify the ORM you are using. Supported values are :activerecord and :mongoid
config.message_broker = :rabbitmq config.message_broker = :rabbitmq
# RabbitMQ configurations # RabbitMQ configurations