This shows you the differences between two versions of the page.
|
dwsc:servercontrol:msg [2013/04/01 21:55] ivan |
dwsc:servercontrol:msg [2013/05/03 13:59] (current) efpe |
||
|---|---|---|---|
| Line 6: | Line 6: | ||
| Message serializer: MessagePack | Message serializer: MessagePack | ||
| - | Request: | + | ==== Request ==== |
| <code> | <code> | ||
| class DWSCReq { | class DWSCReq { | ||
| Line 13: | Line 13: | ||
| public $at = null; // auth token | public $at = null; // auth token | ||
| public $s = ""; // source: <host> | public $s = ""; // source: <host> | ||
| - | public $t = ""; // target: edge | origin | <host> | + | public $t = ""; // target: edge | origin | "*" | <host> |
| public $vh = ""; // virtual host | public $vh = ""; // virtual host | ||
| public $a = ""; // application | public $a = ""; // application | ||
| Line 25: | Line 25: | ||
| </code> | </code> | ||
| - | Reply: | + | ==== Reply ==== |
| <code> | <code> | ||
| class DWSCRep { | class DWSCRep { | ||
| Line 35: | Line 35: | ||
| </code> | </code> | ||
| - | Commands: | + | ==== Commands ==== |
| <code> | <code> | ||
| class DWSCCmd { | class DWSCCmd { | ||
| Line 43: | Line 43: | ||
| const SUSPEND = 4; | const SUSPEND = 4; | ||
| const DISCONNECT_CLIENTS = 5; | const DISCONNECT_CLIENTS = 5; | ||
| + | const NOCLUSTER = 6; | ||
| + | const ONLINE = 7; | ||
| + | const RESULT = 8; | ||
| + | const SRVSTATUS = 9; | ||
| + | const VHOSTSLOAD = 10; | ||
| + | |||
| } | } | ||
| </code> | </code> | ||
| - | + | ==== msgpack ==== | |
| - | msgpack example: | + | |
| <code> | <code> | ||
| $msg = new DWSCReq(); | $msg = new DWSCReq(); | ||
| Line 55: | Line 60: | ||
| echo var_export(msgpack_unserialize($smsg), true); | echo var_export(msgpack_unserialize($smsg), true); | ||
| + | </code> | ||
| + | |||
| + | ====== Admin ====== | ||
| + | ZeroMQ context is registered as a service in the Admin system. | ||
| + | <code> | ||
| + | $socket = $this->get('docler_zero_mq.socket'); | ||
| + | </code> | ||
| + | This creates a context and a socket object, then returns with an instance. The returned //ZeroMQSocket// contains the message pack module too, which is accessible through the //getMessagePack()// method. | ||
| + | You can access the DWSC message formats classess in the //Docler\ZeroMQBundle\Protocol// namespace. | ||
| + | |||
| + | The default //send()// method packs the message (as //recv()// which unpacks it): | ||
| + | <code>public function send(DWSCRequest $msg, $pack = true) { } | ||
| + | public function recv($unpack = true) { } | ||
| + | </code> | ||
| + | ==== ZeroMQSocket parameters ==== | ||
| + | config.yml: | ||
| + | <code> | ||
| + | docler_zero_mq: | ||
| + | context_io_threads: 1 | ||
| + | context_is_persistent: false | ||
| + | socket_type: SOCKET_REQ | ||
| + | socket_dsn: //this is the only required parameter// | ||
| + | socket_persistent_id: //null// | ||
| + | socket_opts: | ||
| + | SOCKOPT_SNDHWM: 100 | ||
| </code> | </code> | ||