Skip to content

Commit

Permalink
Document the new CreatingTacticianHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisguitarguy committed Aug 26, 2016
1 parent bef6911 commit a6c2d02
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/handlers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ Using Tactician to Handle Messages
`Tactician <https://tactician.thephpleague.com/>`_ is a command bus from The PHP
League. You can use it to do message handling with the queue.

.. code-block:: bash
composer install pmg/queue-tactician
Use the same command bus with each message.

.. code-block:: php
<?php
Expand All @@ -125,6 +131,27 @@ League. You can use it to do message handling with the queue.
/** @var PMG\Queue\Driver $driver */
$consumer = new DefaultConsumer($driver, $handler);
Alternative, you can create a new command bus to handle each message with
`CreatingTacticianHandler`. This is useful if you're using
:ref:`forking child processes <forking_handler>` to handle messages.

.. code-block:: php
<?php
use League\Tactician\CommandBus;
use PMG\Queue\DefaultConsumer;
use PMG\Queue\Handler\CreatingTaticianHandler;
$handler = new TacticianHandler(function () {
return new CommandBus(/* ... */);
});
/** @var PMG\Queue\Driver $driver */
$consumer = new DefaultConsumer($driver, $handler);
.. _forking_handler:

Handling Messages in Separate Processes
---------------------------------------

Expand Down

0 comments on commit a6c2d02

Please sign in to comment.