This is an example implementation of message bus on a web-application. This can often be a way to distribute load across an application, allowing work to be placed in a queue and processed independently.
Steps:
- Clone this repository
- Move to the message-bus directory using
cd message-bus/
- Run
composer install && composer dump-autoload -o
- Run
php -S localhost:8000 -t public
- Open another tab in terminal and move to
scripts
directory - Run
php worker_script.php
- Open Postman or apps like postman
- Create a post request with url
http://localhost:8000/create
and post paramkey = some values
- Then send the request and watch the response in your postman response
- Also check the response in worker tab in terminal