Skip to content

Commit

Permalink
Route command message through amqp transport.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lutacon committed Dec 17, 2018
1 parent 5b69555 commit c969c87
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 193 deletions.
403 changes: 216 additions & 187 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions config/packages/messenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ framework:
messenger.bus.command:
middleware:
- messenger.middleware.validation
#- messenger.middleware.handles_recorded_messages: ['@messenger.bus.event']
#- doctrine_transaction_middleware: ['default']
messenger.bus.query:
middleware:
- messenger.middleware.validation
messenger.bus.event:
middleware:
- messenger.middleware.allow_no_handler
- messenger.middleware.validation
routing:
'App\Application\Command\CommandMessage': amqp
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<!-- ###- lexik/jwt-authentication-bundle ### -->

<!-- ###+ symfony/messenger ### -->
<!-- <env name="MESSENGER_TRANSPORT_DSN" value="amqp://guest:guest@localhost:5672/%2f/messages"/> -->
<env name="MESSENGER_TRANSPORT_DSN" value="amqp://guest:guest@rmq:5672/%2f/elastic_events"/>
<!-- ###- symfony/messenger ### -->
</php>

Expand Down
7 changes: 7 additions & 0 deletions src/Application/Command/CommandMessage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace App\Application\Command;

interface CommandMessage
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

namespace App\Application\Command\User\ChangeEmail;

use App\Application\Command\CommandMessage;
use App\Domain\User\ValueObject\Email;
use Ramsey\Uuid\Uuid;

class ChangeEmailCommand
class ChangeEmailCommand implements CommandMessage
{
/** @var \Ramsey\Uuid\UuidInterface */
public $userUuid;
Expand Down
3 changes: 2 additions & 1 deletion src/Application/Command/User/SignIn/SignInCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

namespace App\Application\Command\User\SignIn;

use App\Application\Command\CommandMessage;
use App\Domain\User\ValueObject\Email;

class SignInCommand
class SignInCommand implements CommandMessage
{
/**
* @var Email
Expand Down
3 changes: 2 additions & 1 deletion src/Application/Command/User/SignUp/SignUpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace App\Application\Command\User\SignUp;

use App\Application\Command\CommandMessage;
use App\Domain\User\ValueObject\Auth\Credentials;
use App\Domain\User\ValueObject\Auth\HashedPassword;
use App\Domain\User\ValueObject\Email;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;

class SignUpCommand
class SignUpCommand implements CommandMessage
{
/**
* @var UuidInterface
Expand Down
3 changes: 3 additions & 0 deletions src/Infrastructure/User/Query/Projections/UserView.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

class UserView implements UserViewInterface
{
/**
* @throws \Assert\AssertionFailedException
*/
public static function fromSerializable(Serializable $event): self
{
return self::deserialize($event->serialize());
Expand Down

0 comments on commit c969c87

Please sign in to comment.