prooph / documentation Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
Hello,
I guess this is on your todo list, but I'm opening an issue to keep track of it.
Feel free to close it, if you think this is overkill!
Here's the EventStore.org API page listing available community clients: https://eventstore.org/docs/getting-started/which-api-sdk/index.html
I've also detected an issue with the AggregateRepository
blueprint as it never calls connectAsync
(nor close
) on the eventStoreConnection
property.
This results in the following error when calling getAggregateRoot
:
[2019-12-05 12:55:27] app.DEBUG: EventStoreNodeConnection 'app': enqueing message StartOperationMessage [] []
[2019-12-05 12:55:27] app.DEBUG: EventStoreNodeConnection 'app': enqueing message CloseConnectionMessage [] []
[2019-12-05 12:55:27] app.DEBUG: EventStoreNodeConnection 'app': CloseConnection, reason Connection close requested by client, exception <none> [] []
[2019-12-05 12:55:27] app.DEBUG: EventStoreNodeConnection 'app': CloseTcpConnection IGNORED because connection === null [] []
[2019-12-05 12:55:27] app.INFO: EventStoreNodeConnection 'app': Closed. Reason: Connection close requested by client [] []
I've experienced a few issue while setting up a persistent subscription to update my readl model.
I will try to list them here in a concise way, let's discuss about it afterward.
UserEventAppeared
example class in the read model section should implement EventAppearedOnPersistentSubscription
.PersistentSubscriptionSettings::create() ->build();
which will NOT resolve links and set startFrom
to -1.
startFrom: -1
will ignore all the previous events of the stream. As it is suggested to enable the $by_category
projection juste before setting up the persistent subscription, no events will be handled by the mysql subscriber. That is quite tricky to understand IMO.Here's my read model subscriber:
<?php
declare(strict_types=1);
namespace App\Contribution\Infrastructure\ReadModel;
use Amp\Promise;
use App\Contribution\Application\ReadModel\Contributions;
use Prooph\EventStore\Async\EventAppearedOnPersistentSubscription;
use Prooph\EventStore\Async\EventStorePersistentSubscription;
use Prooph\EventStore\ResolvedEvent;
use Doctrine\DBAL\Connection;
use Amp\Success;
use Prooph\EventStore\Util\Json;
final class PostgreSQLContributions implements Contributions, EventAppearedOnPersistentSubscription
{
private const TABLE_NAME = 'contributions';
private $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
public function __invoke(
EventStorePersistentSubscription $subscription,
ResolvedEvent $resolvedEvent,
?int $retryCount = null
): Promise {
$event = $resolvedEvent->event();
$data = Json::decode($event->data());
switch ($event->eventType()) {
case 'contribution-opened':
$sql = 'INSERT INTO %s (id, title, url, state, created_at, updated_at) VALUES (:id, :title, :url, \'opened\', :created_at, :updated_at)';
$this->connection->executeUpdate(sprintf($sql, self::TABLE_NAME), [
'id' => $data['id'],
'title' => $data['title'],
'url' => $data['url'],
'created_at' => $data['createdAt'],
'updated_at' => $data['updatedAt'],
]);
break;
case 'contribution-closed':
$sql = 'UPDATE %s SET state = \'closed\', closed_at = :closed_at WHERE id = :id';
$this->connection->executeUpdate(sprintf($sql, self::TABLE_NAME), [
'id' => $data['id'],
'closed_at' => $data['closedAt'],
]);
break;
case 'contribution-merged':
$sql = 'UPDATE %s SET state = \'merged\' WHERE id = :id';
$this->connection->executeUpdate(sprintf($sql, self::TABLE_NAME), [
'id' => $data['id'],
]);
break;
}
return new Success();
}
public function all(): array
{
}
}
Somehow, images are not generated (I got a 404 on http://localhost:8080/event-store-v7/tutorial/why_event_sourcing/img/process_to_uml.png for instance)
There are also references to unknown EventStoreAsyncConnectionFactory
and EventStoreSyncConnectionFactory
classes on the /getting-started/step-1/index.html
page.
I've found an EventStoreConnectionFactory
class, but I'm not sur if it handles both sync and async connection.
I believe that namespaces have been reworked.
Prooph\EventStoreClient\EventStoreConnectionFactory
allows creation of instances of Prooph\EventStore\Async\EventStoreConnection
.
Interface Prooph\EventStore\EventStoreConnection
also exists, although it does seem to have any concretion.
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.