PHP Classes

File: doc/GetStarted/Buses.md

Recommend this page to a friend!
  Classes of Niko   PHP HouseHold   doc/GetStarted/Buses.md   Download  
File: doc/GetStarted/Buses.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP HouseHold
Manage the stock of groceries in a house
Author: By
Last change:
Date: 2 years ago
Size: 1,139 bytes
 

Contents

Class file image Download

Command Bus and Query Bus

Why tactician bus and not broadway bus?

Broadway has a CommandBus implementation but not a QueryBus. The interface does not allow you to return content so you need to build your own.

Tactician CommandHandlerMiddleware::execute has:

  return $handler->{$methodName}($command);

It allows you to return content from you Handlers, something required for a QueryBus.

The configuration for a Symfony app will be like that:

tactician:
    default_bus: command
    method_inflector: tactician.handler.method_name_inflector.invoke
    commandbus:
        query:
            middleware:
                - tactician.commandbus.query.middleware.command_handler
        command:
            middleware:
                - tactician.commandbus.command.middleware.command_handler

So you can create your own middleware for example to generate a backend caching for your read model.

tactician:
	...
    commandbus:
        query:
            middleware:
+               - app.bus.query.middleware.cache
                - tactician.commandbus.query.middleware.command_handler