compared with
Current by Slavey Karadzhov
on May 09, 2012 10:06.

(show comment)
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (68)

View Page History
{toc}
<ac:macro ac:name="toc" />

{note:title=Work in Progress}
<ac:macro ac:name="note"><ac:parameter ac:name="title">Work in Progress</ac:parameter><ac:rich-text-body>
<p>This page is work in progress. Please discuss and feel free to edit, rephrase, extend with more cases and examples.</p></ac:rich-text-body></ac:macro>
{note}

h2. Overview
<h2>Overview</h2>

<p>RPC stands for Remote Procedure Call. The purpose of the Zend\Rpc component is to allow the Zend Framework 2 users to make (distributed) RPC calls in an easy way while reusing their existing classes. This component goes even further by allowing the developers to choose how to serialize and transport the information depending on the current environment and their needs. </p>

h2. References
<h2>References</h2>

<p>TDB</p>

h2. Dependencies on PHP modules
<h2>Dependencies on PHP modules</h2>

* php_zmq http://php.zero.mq/
* php_msgpack http://msgpack.org/
<ul>
<li>php_zmq <a class="external-link" href="http://php.zero.mq/">http://php.zero.mq/</a></li>
<li>php_msgpack <a class="external-link" href="http://msgpack.org/">http://msgpack.org/</a></li>
</ul>

h2. Dependencies on Other Framework Components

h2. Class Index
<h2>Dependencies on Other Framework Components</h2>

* Zend\Rpc\Server
* Zend\Rpc\Client
* Zend\Rpc\Hub\Zmq
* Zend\Rpc\Transport
* Zend\Rpc\Transport\Adapter
* Zend\Rpc\Transport\Zmq
* Zend\Rpc\Transport\Rabbitmq
* Zend\Rpc\Serializer
* Zend\Rpc\Serializer\Adapter
* Zend\Rpc\Serializer\Json
* Zend\Rpc\Serializer\Msgpack
<h2>Class Index</h2>

<ul>
<li>Zend\Rpc\Server</li>
<li>Zend\Rpc\Client</li>
<li>Zend\Rpc\Hub\Zmq</li>
<li>Zend\Rpc\Transport</li>
<li>Zend\Rpc\Transport\Adapter</li>
<li>Zend\Rpc\Transport\Zmq</li>
<li>Zend\Rpc\Transport\Rabbitmq</li>
<li>Zend\Rpc\Serializer</li>
<li>Zend\Rpc\Serializer\Adapter</li>
<li>Zend\Rpc\Serializer\Json</li>
<li>Zend\Rpc\Serializer\Msgpack</li>
</ul>

h2. Theory of Operation

TBD

h3. Client
<h2>Theory of Operation</h2>

{code:php} <p>TBD</p>

<h3>Client</h3>

<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[
namespace Zend\Rpc;
use Zend\Rpc\Serializer as Serializer;
}
}
{code}
]]></ac:plain-text-body></ac:macro>

h3. Server
<h3>Server</h3>

<p>Zend\Rpc\Server.php</p>
{code:php}
<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[
namespace Zend\Rpc;

}
}
{code}
]]></ac:plain-text-body></ac:macro>

h3. Transport
Zend\Rpc\Transport\Adapter.php <h3>Transport</h3>
<p>Zend\Rpc\Transport\Adapter.php</p>

{code:php}
<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[
namespace Zend\Rpc\Transport;

}

{code}
]]></ac:plain-text-body></ac:macro>


h3. Serializer
Zend\Rpc\Serializer\Adapter.php <h3>Serializer</h3>
{code:php} <p>Zend\Rpc\Serializer\Adapter.php</p>
<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[
<?php
namespace Zend\Rpc\Serializer;
public function decode($data);
}
{code}
]]></ac:plain-text-body></ac:macro>


h2. Use cases
<h2>Use cases</h2>

h3. Create a RPC server
<h3>Create a RPC server</h3>

{code:php}
<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[

use Zend\Rpc\Server as Server;
$server->handle();

{code}
]]></ac:plain-text-body></ac:macro>

h3. Create a PRC client
<h3>Create a PRC client</h3>

{code:php}
<ac:macro ac:name="code"><ac:default-parameter>php</ac:default-parameter><ac:plain-text-body><![CDATA[
use Zend\Rpc\Client as Client;
use Zend\Rpc\Transport\Zmq as Transport;
$client = new Client($transport);
print $client->plus(5, 3)."\n";
{code}
]]></ac:plain-text-body></ac:macro>

h3. Distributed Computing
<h3>Distributed Computing</h3>

<p>In the case of RabbitMQ as a transport the RPC is already distributed. In the case of ZeroMQ we can create a hub using the following code<br />
TBD</p>