[Chapter7] Improvements
This commit is contained in:
10
Makefile
10
Makefile
@@ -20,15 +20,15 @@ DOCKER = $(shell which docker)
|
||||
DOCKER_COMPOSE = $(DOCKER) compose
|
||||
|
||||
# Default target when run with just 'make'
|
||||
default: up
|
||||
default: start
|
||||
|
||||
.PHONY: up
|
||||
up:
|
||||
.PHONY: start
|
||||
start:
|
||||
$(DOCKER_COMPOSE) up -d --remove-orphans
|
||||
symfony serve -d --no-tls
|
||||
|
||||
.PHONY: database
|
||||
database:
|
||||
.PHONY: infrastructure
|
||||
infrastructure:
|
||||
redis-cli flushall
|
||||
http --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/events/contents
|
||||
http --auth guest:guest DELETE http://localhost:15672/api/queues/%2F/commands/contents
|
||||
|
||||
@@ -92,7 +92,7 @@ Expected output
|
||||
|
||||
The response to the HTTP request and the Authors in the database are not the only outcome generated. In RabbitMQ, there are store multiple events of type `NewAuthorSigned`. Those Domain Events are waiting to be handled. In order to do so, they will have to be consumed. Until not getting consumed, the Follower Counters Query will still return a 404 HTTP Status Code.
|
||||
|
||||
# consume
|
||||
#### Consuming Events
|
||||
|
||||
php bin/console messenger:consume events_async
|
||||
|
||||
@@ -108,6 +108,10 @@ Expected output
|
||||
08:59:13 INFO [messenger] Message Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned handled by Cheeper\Chapter7\Infrastructure\Application\Author\Event\SymfonyNewAuthorSignedEventHandler::handle ["message" => Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned^ { …},"class" => "Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned","handler" => "Cheeper\Chapter7\Infrastructure\Application\Author\Event\SymfonyNewAuthorSignedEventHandler::handle"]
|
||||
08:59:13 INFO [messenger] Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned was handled successfully (acknowledging to transport). ["message" => Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned^ { …},"class" => "Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned"]
|
||||
|
||||
There is one `NewAuthorSigned` event to handle for each new Author signed in. That's a total of three. In Cheeper, the `NewAuthorSigned` is handled by the `SymfonyNewAuthorSignedEventHandler` class. Chapter 6 showed that `SymfonyNewAuthorSignedEventHandler` is
|
||||
|
||||
Now, that all the Domain Events are processed, and their corresponding Projections are calculated, the queries to check how many followers - an Author has - are not empty anymore.
|
||||
|
||||
#### Follower Counters Query
|
||||
|
||||
http --json --body http://127.0.0.1:8000/chapter7/author/a64a52cc-3ee9-4a15-918b-099e18b43119/followers-counter
|
||||
|
||||
Reference in New Issue
Block a user