You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+17-5
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Outboxable
2
2
3
-
The Outboxable Gem is tailored for Rails applications to implement the transactional outbox pattern. It currently only supports ActiveRecord.
3
+
The Outboxable Gem is tailored for Rails applications to implement the transactional outbox pattern. It supports both ActiveRecord and Mongoid.
4
4
5
5
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.
6
6
@@ -25,13 +25,19 @@ If bundler is not being used to manage dependencies, install the gem by executin
25
25
$ gem install outboxable
26
26
```
27
27
28
-
Then run:
28
+
For use with ActiveRecord, run:
29
29
30
30
```shell
31
-
$ rails g outboxable:install
31
+
$ rails g outboxable:install --orm activerecord
32
32
```
33
33
34
-
The command above will add a migration file and the Outbox model. You will need then to run the migrations:
34
+
For use with Mongoid, run:
35
+
36
+
```shell
37
+
$ rails g outboxable:install --orm mongoid
38
+
```
39
+
40
+
The command above will add a migration file and the Outbox model. You will need then to run the migrations (ActiveRecord only):
35
41
36
42
```shell
37
43
$ rails db:migrate
@@ -64,7 +70,7 @@ module Outboxable
64
70
end
65
71
66
72
Outboxable.configure do |config|
67
-
# Specify the ORM you are using. For now, only ActiveRecord is supported.
73
+
# Specify the ORM you are using. Supported values are :activerecord and :mongoid
68
74
config.orm =:activerecord
69
75
70
76
# 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
208
214
$ bundle exec sidekiq
209
215
```
210
216
217
+
218
+
219
+
### Mongoid
220
+
221
+
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.
222
+
211
223
## Development
212
224
213
225
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.
0 commit comments