When using simple operation runners, you can create them using the YML configuration of the bundle. Each operation runner
have a name (
default in the following example). The created operation runner will be available via the service named
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
tolerance: operation_runners: default: retry: runner: callback: ~ waiter: count_limited: count: 10 waiter: exponential_back_off: exponent: 1 waiter: sleep: ~
In that example, that will create a operation runner that is the retry operation runner decorating a callable operation runner. The following image represents the imbrication of the different runners.
This YML factory do not support recursive operation runner. That means that you can’t use a chain runner inside another chain runner. If you need to create more complex operation runners, you should create your own service with a simple factory like the one that was in the tests before this YML factory.
If you just need to add a decorator on a created operation runner, simply uses Symfony DIC decorates features.
If you are using a buffered operation runner, it will automatically run all the buffered operations after the response
it sent to the client (
You can disable this feature with the following configuration:
tolerance: operation_runner_listener: false
This will automatically work with operation runners created using the factory. If you’ve created your own service,
you will need to tag it with
tolerance.operation_runner in order to declare it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?xml version="1.0" ?> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <services> <service id="app.my_buffered_operation_runner" class="Tolerance\Operation\Runner\BufferedOperationRunner"> <!-- Arguments... --> <tag name="tolerance.operation_runner" /> </service> </services> </container>