Comments (3)
Thank you for sharing this. This idea seemed neat to me and so I had it copied in one of my projects.
After using it for a while, I ended up merging both handlers,
- it was more straightforward to do the event-filtering (
EventMatcher
) at the top of theEventHandler
, - it would return before any shared resources (locks) needed to be taken,
- having to maintain 2 functions per event greatly increased the amount of duplicate code.
Unless there are huge performance considerations (which I doubt, since go makes running many thousands of goroutines at the same time possible), I found it led to a simpler overall design.
from eventhorizon.
Glad it could help! I would love to hear more about your implementation, maybe you can show an example in a gist?
from eventhorizon.
This is in magicbus,
- an event is a directed message (
Source() -> Dest()
, it is possible to makeSource()
optional); - the
EventHandler
both- filters events by relevance and
- processes them, as per above comment.
There are 2 ways to process events:
- for Aggregates, these are multiplexed with Commands (i.e. at most 1 Command or Event is being processed at any time), as per Actor "serialized code" principle;
- everything else (e.g. loggers, writers) can subscribe as
Observer
, which means immediate notification.
(Aggregates only get the events whose Dest()
matches the AggregateID, and only if they implement the optional EventHandler
interface).
from eventhorizon.
Related Issues (20)
- EventStore: support Load events with aggregateType HOT 9
- [Question] Multiple domains HOT 2
- [Command Validation] Allow 0 as valid command value
- [Command validation] allow custom logic for IsZero
- Custom MongoDB Collection name for `events` HOT 1
- What's the difference between gcp eventbus and local eventbus HOT 2
- [eventbus] Support Kafka clustering HOT 8
- Add error check for nil event/command
- More explicit error message when trying to project event to deleted projection HOT 1
- [scheduler] Use a lock to avoid scheduling race
- Slack channel sign-up link in the README.md is no longer active HOT 3
- The Todo MVC example not starting properly
- [eventbus/kafka] event is not retried after error in saga.
- AMQP Event Bus? HOT 1
- DB Mutex of Memory outbox blocks Saga HOT 1
- Switch to OpenTelemetry HOT 5
- Is it going to be maintained? HOT 1
- React / Angular / VanillaJS Examples HOT 1
- Additional configuration options for Kafka event bus HOT 1
- Generic Go 1.18 Support
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 eventhorizon.