A complete asynchronous task processing system with multiple processes, exception retry
Add a composer.json
file to your project:
{
"require": {
"luojilab/async-task-lib": "1.0.*"
}
}
Then provided you have composer installed, you can run the following command:
$ composer.phar install
That will fetch the library and its dependencies inside your vendor folder.
With Message mode running open two Terminals and on the first one execute the following commands to start the worker:
$ cd php-async-lib/demo
$ php Worker.php
Then on the other Terminal do:
$ cd php-async-lib/demo
$ php Publish.php some text to publish
You should see the message arriving to the process on the other Terminal
With Event mode running open three Terminals and on the first one execute the following commands to start the worker:
$ cd php-async-lib/demo
$ php event/service.php
Then on the second Terminal do:
$ cd php-async-lib/demo
$ php event/worker.php
Then on the last Terminal do:
$ cd php-async-lib/demo
$ php event/event.php
You should see the message arriving to the process on the second Terminal