Download the PHP package so-php/rpc without Composer
On this page you can find all versions of the php package so-php/rpc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package rpc
rpc
RPC Pattern via php-amqplib
Avoiding Technology Lockout
One of the goals of ths implementation is to prevent locking out other technologies like python, ruby and java from producing or consuming requests. This is not a terribly difficult task--it just means we need to use a non-proprietary message queue (php-amqplib + rabbitmq) and a message format that isn't language specific. Hence we choose to use a json serialized data structure rather than a PHP serialized string.
That being said, there are no enforced restrictions on the content of the PRC params. It is up to developers to keep vigilant and be sure not to stuff anything in an RPC that is PHP or platform specific.
Message Structure
As stated above, the message is a plain Json string. The structure is an object with three keys (only) at the top level.
method
the method nameparams
an array to hold rpc params. No imposed limits other than technical feasibility and reasonableness. Params should be present even if empty[]
. Params are ordered, and will be provided to the RP in the same order they are received.
Usage
Using RPC is pretty straight forward. Words in uppercase are values that need to be supplied/configured.
Server
First we need to start an RPC Server queue and bind it a class/method.
Output might look something like:
`Listening for RPCs @ amq.gen-v1ac3`
Client
The client looks a bit like this:
Output might look like:
`Hello bob`
Wait, wait, wait...
"You mean I have to somehow orchestrate configuring my RPC client with the correct queue for the server?" I hear you asking. The answer is, unapologetically, yes. But you shouldn't do that, you should use a service registry pattern for that. Try so-php/service-registry.
All versions of rpc with dependencies
zendframework/zend-code Version 2.3.*@dev
videlalvaro/php-amqplib Version *
so-php/php-amqplib-extensions Version ~0.0-alpha