Merge pull request #320

This commit is contained in:
symfony-flex-server[bot]
2018-10-29 08:15:42 +00:00
committed by GitHub
11 changed files with 148 additions and 0 deletions
@@ -0,0 +1,15 @@
services:
_defaults:
public: false
Prooph\EventStoreBusBridge\EventPublisher:
arguments:
- '@prooph_service_bus.default_event_bus'
tags:
- { name: 'prooph_event_store.default.plugin' }
Prooph\EventStoreBusBridge\TransactionManager:
arguments:
- '@app.event_store.default'
tags:
- { name: 'prooph_service_bus.default_command_bus.plugin' }
@@ -0,0 +1,5 @@
{
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
@@ -0,0 +1,10 @@
prooph_event_store:
stores:
default:
event_store: 'app.event_store.default'
services:
_defaults:
public: false
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~
@@ -0,0 +1,9 @@
{
"bundles": {
"Prooph\\Bundle\\EventStore\\ProophEventStoreBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}
@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Command;
use Prooph\EventStore\EventStore;
use Prooph\EventStore\Stream;
use Prooph\EventStore\StreamName;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
final class CreateEventStreamCommand extends ContainerAwareCommand
{
private $eventStore;
public function __construct(EventStore $eventStore)
{
$this->eventStore = $eventStore;
}
protected function configure()
{
$this->setName('event-store:event-stream:create')
->setDescription('Create event_stream.')
->setHelp('This command creates the event_stream');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->eventStore->create(new Stream(new StreamName('event_stream'), new \ArrayIterator([])));
$output->writeln('<info>Event stream was created successfully.</info>');
}
}
@@ -0,0 +1,22 @@
services:
_defaults:
public: false
Prooph\EventStore\EventStore: '@app.event_store.default'
app.event_store.default:
class: Prooph\EventStore\Pdo\MySqlEventStore
arguments:
- '@prooph_event_store.message_factory'
- '@app.event_store.pdo_connection.mysql'
- '@app.event_store.mysql.persistence_strategy'
app.event_store.pdo_connection.mysql:
class: \PDO
arguments:
- '%env(MYSQL_DSN)%'
- '%env(MYSQL_USER)%'
- '%env(MYSQL_PASSWORD)%'
app.event_store.mysql.persistence_strategy:
class: Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy
+13
View File
@@ -0,0 +1,13 @@
{
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"copy-from-package": {
"scripts/": "%CONFIG_DIR%/scripts/"
},
"env": {
"MYSQL_DSN": "mysql:host=127.0.0.1;dbname=event_streams",
"MYSQL_USER": "user",
"MYSQL_PASSWORD": "password"
}
}
@@ -0,0 +1,8 @@
<bg=blue;fg=white> </>
<bg=blue;fg=white> MySql Event Store Configuration </>
<bg=blue;fg=white> </>
* Modify your MYSQL_* configuration in <fg=green>.env</>
* Create event streams and projections tables using SQL scripts
in <comment>%CONFIG_DIR%/scripts/*</comment>
@@ -0,0 +1,13 @@
prooph_service_bus:
command_buses:
default_command_bus: ~
event_buses:
default_event_bus: ~
query_buses:
default_query_bus: ~
services:
_defaults:
public: false
Prooph\ServiceBus\CommandBus: '@prooph_service_bus.default_command_bus'
@@ -0,0 +1,8 @@
{
"bundles": {
"Prooph\\Bundle\\ServiceBus\\ProophServiceBusBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
@@ -0,0 +1,9 @@
<bg=blue;fg=white> </>
<bg=blue;fg=white> Service Bus Configuration </>
<bg=blue;fg=white> </>
* Verify and uncomment the configuration in <comment>%CONFIG_DIR%/packages/prooph_service_bus.yaml</>
to register message handlers
* Dispatch commands by injecting
the <comment>Prooph\ServiceBus\CommandBus</comment> service into your controllers