Permalink
Browse files

Use NSQ client instead of http post

  • Loading branch information...
1 parent d5e627c commit 700436227518d2d72078ac7695f2c4b24b532ef9 @cdujeu cdujeu committed May 23, 2016
Showing with 8 additions and 4 deletions.
  1. +2 −1 core/src/core/composer.json
  2. +6 −3 core/src/plugins/core.mq/class.MqManager.php
@@ -14,7 +14,8 @@
"gimler/guzzle-description-loader" : "*",
"commerceguys/guzzle-oauth2-plugin": "~2.0",
"nikic/fast-route":"~1.0",
- "symfony/console":"^3.0"
+ "symfony/console":"^3.0",
+ "davegardnerisme/nsqphp": "dev-master"
}
}
@@ -19,6 +19,7 @@
* The latest code can be found at <http://pyd.io/>.
*/
+use nsqphp\nsqphp;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Access\Core\Model\AJXP_Node;
@@ -178,8 +179,6 @@ public function sendInstantMessage($xmlContent, $repositoryId, $targetUserId = n
$this->msgExchanger->publishInstantMessage("nodes:$repositoryId", $message);
}
- // Publish to NSQ for WebSockets
- $client = new GuzzleHttp\Client();
// Publish for websockets
$input = array("REPO_ID" => $repositoryId, "CONTENT" => "<tree>".$xmlContent."</tree>");
@@ -192,7 +191,11 @@ public function sendInstantMessage($xmlContent, $repositoryId, $targetUserId = n
$input["NODE_PATHES"] = $nodePathes;
}
- $client->post('http://127.0.0.1:4151/put?topic=im', ['json' => $input, 'future' => true]);
+
+ // Publish on NSQ
+ $nsq = new nsqphp;
+ $nsq->publishTo("127.0.0.1", 1);
+ $nsq->publish('im', new \nsqphp\Message\Message(json_encode($input)));
$this->hasPendingMessage = true;

0 comments on commit 7004362

Please sign in to comment.