friendsofouro / broadway-eventstore Goto Github PK
View Code? Open in Web Editor NEWGetEventStore support for Broadway
License: MIT License
GetEventStore support for Broadway
License: MIT License
In EventStore implementation, the append method always try to write to stream, even if there are no events to write. This causes a 400 error to be thrown, because is trying to write empty content in the stream.
I suggest doing a check in the append method:
if(count($events) > 0) {
try {
$this
->eventStore
->writeToStream(
$id,
new WritableEventCollection($events),
$playhead - 1
)
;
} catch (WrongExpectedVersionException $e) {
dd($e->getMessage());
throw new BroadwayOptimisticLockException($e->getMessage());
}
}
@dbellettini what do you think?
Now that the client supports it, we can enable it for broadway :)
It's (imho) very wrong to generate the events version (https://github.com/dbellettini/broadway-eventstore/blob/master/src/EventStore/Broadway/BroadwayEventStore.php#L67).
The version is a very important piece when it comes to validate applying them to aggregates as well as resolving conflicts. Instead, the information should come directly from the store. This can be achieved via the URL "aggregate-identifier/version" or, when the EmbedMode::RICH is used, it will be part of the payload.
This is probably also a "downstream" bug/feature that must then be implemented in the eventstore-client. Just checked that I patched the file StreamFeed/Entry to return the event version, so the eventstore-client has no API for this yet (it really should).
If you guys agree, I'd create a PR for both the client and this package getting the event version either from the payload or url.
The eventstore serves the latest events on page 1. So the stream has to be traversed in the opposite direction, starting from last page to first page.
Will provide a PR this evening.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.