Skip to content

Commit

Permalink
Updates documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
broosk1993 committed Apr 14, 2023
1 parent 92ee8d2 commit 3b545b0
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
outboxable (1.0.2)
outboxable (1.0.3)
bunny (>= 2.19.0)
connection_pool (~> 2.3.0)

Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 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.

Expand All @@ -25,13 +25,19 @@ If bundler is not being used to manage dependencies, install the gem by executin
$ 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
Expand Down Expand Up @@ -64,7 +70,7 @@ module Outboxable
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.
Expand Down Expand Up @@ -208,6 +214,12 @@ Last but not least, run sidekiq so that the Outboxable Gem can publish the event
$ 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.
Expand Down
2 changes: 1 addition & 1 deletion lib/outboxable/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Outboxable
VERSION = '1.0.2'
VERSION = '1.0.3'
end
2 changes: 1 addition & 1 deletion lib/templates/activerecord_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def to_envelope(resource:)
# Specify the ORM you are using. For now, only ActiveRecord is supported.
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

# RabbitMQ configurations
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/mongoid_initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def to_envelope(resource:)
# Specify the ORM you are using. For now, only ActiveRecord is supported.
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

# RabbitMQ configurations
Expand Down

0 comments on commit 3b545b0

Please sign in to comment.