-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple databases repository #740
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mpraglowski
force-pushed
the
multiple-databases-repository
branch
from
July 30, 2020 10:10
04484e0
to
97be130
Compare
mpraglowski
force-pushed
the
multiple-databases-repository
branch
from
August 18, 2020 16:17
204001f
to
53c4884
Compare
Rebased with #753 - only sample app here |
mpraglowski
force-pushed
the
multiple-databases-repository
branch
from
September 11, 2020 17:39
53c4884
to
2af5406
Compare
App generated with RES template with options: ``` rails new sample --template "https://railseventstore.org/new" --skip-spring --skip-listen --skip-bootsnap --skip-git --skip-keeps --skip-action-text --skip-active-storage --skip-action-cable --skip-action-mailer --skip-action-mailbox --skip-sprockets --skip-javascript --skip-turbolinks --skip-webpack-install --skip-yarn --skip-test --skip-system-test ```
…ventRepository is enough
The connected_active_record gem is not needed. Alctually, I think it is even not the best way to do it. Just RailsEventStoreActiveRecord::EventRepository with given base abstract class is enough. And it is better. The idea is: * each BC module need to implement it's own AR base class, * any models used by this BC should inherit from this base class, * BCs data will be now fully separated from main app data (separate dbs) * the only way to interact between BCs are: * direct API calls (including sending commands to command bus) * publishing and handling domain events using BC's public event store Regarding the event stores: * each BC has it's own event store where BC's private domain events are stored, * this private domain events must not leak outside the BC boundary, * any domain event published by BC to external world is stored in public event store (defined on application level) * publishing to public event store could use some patterns like Fat Events, Outbox. See more https://verraes.net/2019/05/ddd-msg-arch/
From https://github.com/RailsEventStore/cqrs-es-sample-with-res with some changes: * RSpec instead of MiniTest * use RES RSpec matchers
Because of Rails initialization process. No database configurations ready when we need to initialize new number generator instance. This way (by using factory) we delay it's initialization to the moment when it is really needed. And at this time database is ready waiting for connections :)
Because one could not link to events from different event store. A separate model for process state is needed here. This could be implemented as a snapshoot event and reading only last event from process stream but I've gone with AR based process state model to show that typical AR models could be also used in multiple databases model.
Needed to run test in scope of the single BC
mpraglowski
force-pushed
the
multiple-databases-repository
branch
from
September 15, 2020 08:32
2af5406
to
c8683d1
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Described here https://blog.arkency.com/rails-multiple-databases-support-in-rails-event-store/