12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- require_once(BASE_CORE_PATH . '/framework/function/http.php');
- class processor extends queue\ILooper
- {
- private $mProxy;
- public function __construct()
- {
- parent::__construct(new queue\DispatcherServer());
- $this->mProxy = new proxy();
- }
- protected function handle($msg)
- {
- if (empty($msg)) {
- Log::record('empty body', Log::DEBUG);
- }
- else
- {
- foreach ($msg as $key => $params)
- {
- Log::record("start one", Log::DEBUG);
- if (empty($params)) continue;
- $method = strtolower($key);
- try
- {
- if ($method == 'add') {
- $this->mProxy->add($params);
- } elseif ($method == 'notify') {
- $channel = $params['channel'];
- $input = $params['input'];
- $this->mProxy->notify($channel,$input);
- } else {
- Log::record("Error msg", Log::DEBUG);
- }
- } catch (Exception $x) {
- Log::record($x->getMessage(), Log::ERR);
- }
- }
- }
- }
- }
|