-
-
Notifications
You must be signed in to change notification settings - Fork 644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added recipe for the Prooph pack #320
Changes from 28 commits
ff73795
1d6cb4b
1d495c0
a3e37cc
41dca24
9e9d069
2fde35c
17a7249
26ec16d
b5711fb
31b7ce8
f418071
fb0e9e5
2013913
053b5d8
d218ca1
1054024
ee6ef3a
1db9529
02c6ded
c48c336
403a1fa
2385bdc
e167532
6232196
f45406f
00ba2ea
3bf651b
838f441
47394ca
245e200
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
services: | ||
_defaults: | ||
public: false | ||
|
||
Prooph\EventStoreBusBridge\EventPublisher: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about explicitly passing the event bus ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, configuration might benefit from being a bit more explicit here. In that case, I would remove the |
||
arguments: | ||
- '@prooph_service_bus.default_event_bus' | ||
tags: | ||
- { name: 'prooph_event_store.default.plugin' } | ||
|
||
# The app.event_store.default service must be configured with a | ||
# Prooph\EventStore\TransactionalEventStore instance in order to user the following plugin. | ||
# Read more: http://docs.getprooph.org/event-store/implementations/pdo_event_store/variants.html#3-2-1-2 | ||
# | ||
# Prooph\EventStoreBusBridge\TransactionManager: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not like config in comments like this. If you think that 90% of the users will use this config you should un-comment this. If not I think these lines should be removed. |
||
# arguments: | ||
# - '@app.event_store.default' | ||
# tags: | ||
# - { name: 'prooph_service_bus.default_command_bus.plugin' } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
prooph_event_store: | ||
stores: | ||
default: | ||
event_store: 'app.event_store.default' | ||
# repositories: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these comments really needed? |
||
# App\EventSourcing\TodoRepository: | ||
# aggregate_type: App\EventSourcing\Todo | ||
# aggregate_translator: Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator | ||
|
||
services: | ||
_defaults: | ||
public: false | ||
|
||
Prooph\EventSourcing\EventStoreIntegration\AggregateTranslator: ~ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"bundles": { | ||
"Prooph\\Bundle\\EventStore\\ProophEventStoreBundle": ["all"] | ||
}, | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/", | ||
"src/": "%SRC_DIR%/" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Command; | ||
|
||
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; | ||
|
||
class CreateEventStreamCommand extends ContainerAwareCommand | ||
{ | ||
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) | ||
{ | ||
$eventStore = $this->getContainer()->get('prooph_event_store.app'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use constructor injection instead? |
||
|
||
$eventStore->create(new Stream(new StreamName('event_stream'), new \ArrayIterator([]))); | ||
$output->writeln('<info>Event stream was created successfully.</info>'); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
services: | ||
_defaults: | ||
public: false | ||
|
||
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: | ||
- 'mysql:host=%env(MYSQL_HOST)%;dbname=%env(MYSQL_DBNAME)%' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could use a environment variable like "MSQL_DSN" here instead. |
||
- '%env(MYSQL_USER)%' | ||
- '%env(MYSQL_PASSWORD)%' | ||
|
||
app.event_store.mysql.persistence_strategy: | ||
class: Prooph\EventStore\Pdo\PersistenceStrategy\MySqlSingleStreamStrategy |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/" | ||
}, | ||
"copy-from-package": { | ||
"scripts/": "%CONFIG_DIR%/scripts/" | ||
}, | ||
"env": { | ||
"MYSQL_HOST": "127.0.0.1", | ||
"MYSQL_DBNAME": "event_streams", | ||
"MYSQL_USER": "user", | ||
"MYSQL_PASSWORD": "password" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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' | ||
|
||
# Autoregister your message handlers here | ||
# Make sure App\Messaging\* services are not overriden in `config/services.yaml` | ||
# Read more at https://github.com/prooph/service-bus-symfony-bundle/blob/master/doc/routing.md | ||
# | ||
# command_handlers: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here.. I think you should un-comment this. |
||
# resource: '../../src/Messaging/Command/*Handler.php' | ||
# namespace: App\Messaging\Command\ | ||
# public: true | ||
# autowire: true | ||
# tags: | ||
# - { name: 'prooph_service_bus.default_command_bus.route_target', message_detection: true } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"bundles": { | ||
"Prooph\\Bundle\\ServiceBus\\ProophServiceBusBundle": ["all"] | ||
}, | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this will work... The regex is just fetching one package...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to understand what you mean by "The regex is just fetching one package". For this PR,
$PACKAGES
contains:Which will not be handled properly if using
composer req "${PACKAGES}"
.The piped
tr
will allows to merge lines into a single line:which will be correctly handled by
composer req
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not being clear.
$PACKAGES
will never contain more that one package.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it does on this PR 🤔