Comments (6)
from event-store.
#37 is somewhat related. The two requirements can be combined.
The ES adapters should only handle plain arrays (serialized domain events).
The Stream class should provide the possibility to attach a Serializer/Unserializer.
The EventStore should inject a serializer when handling the Stream. Default serializer will be a ProophMessageSerializer but custom implementations are allowed (interface required).
Stream::getEventsAsArrays
will use the serializer and Stream::getEvents
will use the unserializer (can of course be the same instance)
Generators will work great for the two methods.
An adapter can then f.e. wrap a PDOStatement with an own iterator to convert the table row into the event array structure and then pass the iterator to a new Stream instance. The Stream is returned to the event store and the store uses setter injection to add the serializer and unserializer. Now the outside world can iterate over Stream::getEvents
and will get a ready to use custom domain event.
Just keep in mind that a PDOStatement does not provide a rewind functionality in all cases so we have to workaround this (maybe by caching the event arrays in the stream?).
A stream interface is maybe also a good idea so we could allow usage of custom stream implementations. One stream would implement a cache and another one not (f.e. to use the pass through mechanism when upcasting or replaying events).
from event-store.
@mvriel: prooph/event-store 5.x will have better support for custom domain events. I wrote down a rough idea (see last comment) but now have to think about it in detail to come up with something that can be implemented.
from event-store.
With prooph/common v3.3 a new Prooph\Common\Messaging\Message
interface was introduced.
The event store and all adapters will be adjusted to type hint only this interface in the future. So custom domain event implementations need to implement the interface but no longer extend a abstract class. That is the best compromise we can make between duck typing (working with plain PHP arrays only) and a strong coupling (extend an abstract class).
from event-store.
Removed BC break label because Prooph\Common\Messaging\DomainMessage
implements the new interface and can therefor be handled by the event store without adjustments.
from event-store.
Closed with #52
from event-store.
Related Issues (20)
- Documentation uses wrong pcntl signal? HOT 4
- Poll: What do you prefer? Server or lib? Or both? HOT 37
- Use ULID instead of autoincrement no HOT 12
- InMemoryEventStoreQuery#fromStream signature does not match interface signature (Query#fromStream) HOT 1
- Emit Enabled default configuration HOT 1
- 7.5.2 is completely breaking from 7.5.1 HOT 3
- Uncaught InvalidArgumentException: Could not create DateTimeImmutable HOT 5
- v7: interface mismatch Query, Projector & ReadModelProjector HOT 3
- Tips for database migration? HOT 7
- SEO when search for `Prooph Add Metadata` HOT 4
- Upcasting broken for projections in v7
- Let ProjectionsManager return objects instead of json-strings HOT 3
- aggregate_version conflict (ConcurrencyException) when stream on heavy load HOT 2
- Tests are missing HOT 5
- Remove further json strings from managers HOT 5
- PersistentSubscriptionCreateStatus wrongly internal ? HOT 2
- Detaching listener handlers from event store HOT 6
- DateTimeStringBugWorkaround fails in PHP 8 HOT 1
- PHP 8 support
- Best practice CI/CD HOT 3
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 event-store.