Comments (8)
Hello @henry-hz, @slashdotdash maybe this could be useful to you, I have a fork at https://github.com/sharksdontfly/commanded/tree/eventstore-behaviour which integrates geteventstore.com (via extreme). Event store usage in commanded is replaced by a behaviour. It has one limitation though, when using extreme
event store ack'ing of events is not implemented. To run all tests for eventstore
or extreme
event store you have to execute MIX_ENV=test mix clean && COMMANDED_EVENT_STORE_ADAPTER=Commanded.EventStore.Adapters.ExtremeEventStore mix test
or MIX_ENV=test mix clean && COMMANDED_EVENT_STORE_ADAPTER=Commanded.EventStore.Adapters.EventStoreEventStore mix test
respectively. Testing extreme
event store takes considerably longer because each time the event store is resetted a docker container is restarted. When using the extreme
event store one has to configure extreme and additionally provide a value for :streams_prefix
(see config/test.exs
). So if you configure bankaccount
here and an event for account ACC123
is written to the event store it will be written to the stream bankaccount-ACC123
.
Additionally there is a module which one can use
to customize event names, it works only when using the integrated Commanded.Serialization.JsonSerializer
. E.g.:
defmodule Events do
alias Commanded.Serialization.JsonSerializer.EventName
defmodule MoneyTransferRequested do
use EventName, "money-transfer-requested"
defstruct [transfer_uuid: nil, debit_account: nil, credit_account: nil, amount: nil]
end
end
from commanded.
- Create an Elixir behaviour to define the contract required for storage.
- Implement a set of unit/integration tests against the behaviour that can be used to verify a given storage provider will work when used. The tests should be configured to run against each supported storage provider. This can be achieved using ExUnit.CaseTemplate.
- Use
optional: true
to reference external dependencies that are supported inmix.exs
(e.g.{:eventstore, "...", optional: true}
)
The individual storage adapters can be wrapped with Code.ensure_loaded
to ensure that the code is only loaded when the consumer of Commanded has added the dependency.
if Code.ensure_loaded?(EventStore) do
# ... `eventstore` provider
end
if Code.ensure_loaded?(Extreme) do
# ... `extreme` provider
end
from commanded.
Auto-snapshotting should be implemented as a separate feature from the storage abstraction. Since snapshotting can be run as a background activity. Completely separate from persisting events for an aggregate. This also ensures that there won't be increased latency on aggregate operations because a snapshot is also being recorded. See #27.
from commanded.
Ok, got it, good design :) I will continue with the database layer, with the contracts, and leave snapshots for the end. Let's avoid early optimizations. I also thought about a "persistence" layer that could receive aggregates and process managers data structures, replay them and send them back, using closures. So I call the closure callback injected the read events from db. The idea is to have a testable, abstract and unique place to persist and rehydrate states for all the application, @slashdotdash makes sense ?
from commanded.
hum... I am cooking:
https://github.com/work-capital/commanded/blob/master/lib/commanded/storage/behaviour.ex
from commanded.
@sharksdontfly Wow. That's an awesome chunk work of work you've done to integrate Greg's event store.
Are you interested in submitting a pull request to merge the changes back in once you're done? That would help out @henry-hz too.
from commanded.
@sharksdontfly wow!
@slashdotdash , seems that we can discard the #42 PR.
from commanded.
Done by #55.
from commanded.
Related Issues (20)
- Process manager router option not working
- Lessons learned from performance optimization - an unlikely culprit HOT 3
- no function clause matching in Commanded.Commands.Dispatcher.telemetry_stop/3 HOT 1
- Docs questions
- Stacktrace in event handler error? HOT 2
- Paralelization Strategies in EventHandlers
- Should Commanded.Event.Handler support messages from swarm? HOT 2
- Event retention policies?
- please support multiple commanded application with one eventstore HOT 6
- Process Manager state serialization breaks when using a custom TypeProvider with the JsonSerializer
- `Commanded.ProcessManagers.ProcessManager.identity/0` function returns `nil` in unit tests
- no function clause matching in Commanded.Event.Handler.partition_event/4 HOT 1
- EventstoreDB is sunsetting the TCP protocol HOT 1
- Is it a bad practice for an event handler to depend on a projector completion? HOT 2
- Snapshotting 2 Aggregates having same identity
- Is it possible to log contents of InMemoryEventStore on failed test?
- Ecto Sandbox, Projections and In Memory adapter HOT 3
- Aggregate throws error when execute returns more than 1000 events.
- Individual stream events handling
- Skipped event with concurrency enabled HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commanded.