- Install composer package
$ composer require mqk/mqk
- Define an asynchronous RPC method
class Calculator
{
public static function sum($a, $b)
{
return $a + $b;
}
}
- Start the consumer process
-vvv print detail log
$ vendor/bin/mqk run -vvv
- Execute asynchronous RPC
\K::invoke('Calculator::sum', 1, 2);
Asynchronous RPC mode is more suitable for sending such a scenario like mail, usually like a message to send such a scene without the need to immediately return the results to the user and the implementation of the event is relatively long.
There are other scenarios that recommend the use of events, when we need to decouple the system, for example, a resource A changes, another resource B depends on the resource A need to maintain the final consistency of the data. Distribute a modification of the A resource, and then monitor the consistency of the event maintenance data.
[Event] (event.md)
Advanced use describes how to handle multiple different queues, and how effective use of concurrency features in MQK.
[Advanced use] (advanced_options.md)