2017 © Pedro Peláez
 

library tactician-prioritycommand-plugin

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

image

connectholland/tactician-prioritycommand-plugin

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  • Monday, April 4, 2016
  • by RonRademaker
  • Repository
  • 2 Watchers
  • 1 Stars
  • 3,025 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 5 % Grown

The README.md

tactician-prioritycommand-plugin

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed, (*1)

Build Status Coverage Status SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Concept

The plugin adds Middleware that allows you to prioritize your commands. To give priority to a command let it extend from one of the command implementations in this library:, (*3)

Default supported command types: - AbstractRequestCommand (bus, you may take a detour, but you may not start a new round) - AbstractSequenceCommand (bus, you may take a detour, but nobody gets off before I do) - AbstractUrgentCommand (take me to my destination asap), (*4)

You can create an interface to your event dispatcher (one for symfony ships with this library). You should attach the PriorityMiddleware::REQUEST queue to some event you always dispatch, preferably after output is sent to your users., (*5)

Suggested priorities

Obviously you're free to give your commands any priority you like, but these guidelines may help:, (*6)

  • Urgent: anything that affects the output you send to your user OR anything that affects the behavior of incoming request
  • Request: anything that affects any subsequent requests from your user
  • Sequence: anything that affects the behavior of following commands (i.e. because it sets an id in your database something else depends on)

Issues

Commands are not executed immediately which makes it impossible to return values. If you rely on the return value of a command, you can't make that command a priority command without breaking your application. The fix for this is to add an event listener before putting the command on the bus and dispatching an event from the handler which passes the return value. Example, code with return value, (*7)

$result = $commandbus->handle($command);
echo "The result is.... {$result}";

Without the return value:, (*8)

$eventdispatcher->addListener('when_my_commandhandler_is_done', function($event) {
    echo "The result is.... {$event->getReturnValue()}";
});
$result = $commandbus->handle($priorityCommand);

The Versions

04/04 2016

dev-master

9999999-dev

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

04/04 2016

0.1.1

0.1.1.0

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

04/04 2016

0.2.0

0.2.0.0

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

04/04 2016

dev-stable-tactician

dev-stable-tactician

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

04/04 2016

dev-stable-tactician-release

dev-stable-tactician-release

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

14/08 2015

dev-revert-bc-break

dev-revert-bc-break

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

14/08 2015

0.1.0

0.1.0.0

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker

14/08 2015

0.1.2

0.1.2.0

Tactician plugin that allows adding a priority to a command which influences when and in what order commands will be executed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ron Rademaker