From 1f596272bb27744a90db32d8ad360b2317a18471 Mon Sep 17 00:00:00 2001 From: Carlos Buenosvinos Date: Sun, 6 Mar 2022 18:47:01 +0100 Subject: [PATCH] [Chapter7] Improvements --- Makefile | 10 +++++----- README.md | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f3ad50b..fd4bcf5 100644 --- a/Makefile +++ b/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 diff --git a/README.md b/README.md index 7b92a0e..558ae1c 100644 --- a/README.md +++ b/README.md @@ -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