|
@@ -67,45 +67,48 @@ class TopicForm extends BaseForm
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- * [获取消息列表]
|
|
|
- * @author: libingke
|
|
|
- */
|
|
|
- public function getQueueList()
|
|
|
- {
|
|
|
- $authStr = Yii::$app->Amqp->user . ':' . Yii::$app->Amqp->pass;
|
|
|
- $url = Yii::$app->Amqp->host . ':' . Yii::$app->Amqp->api_port . "/api/queues";
|
|
|
-
|
|
|
- $curl = new Curl();
|
|
|
- $curl->setOption(CURLOPT_USERPWD, $authStr);
|
|
|
- $result = json_decode($curl->get($url), true);
|
|
|
- if ($curl->responseCode != 200)
|
|
|
- throw new Exception(1002);
|
|
|
-
|
|
|
- if ($curl->errorText)
|
|
|
- throw new Exception(1002, $curl->errorText);
|
|
|
-
|
|
|
- if (isset($result['error']) && is_string($result['error']))
|
|
|
- throw new Exception(1002, $result['error']);
|
|
|
-
|
|
|
- $rows = [];
|
|
|
- foreach ($result as $k => $v) {
|
|
|
-
|
|
|
- $name = $v['name'];
|
|
|
- $rows[$name]['name'] = $name;
|
|
|
- $rows[$name]['messages_count'] = $v['messages'];
|
|
|
- $rows[$name]['message_bytes'] = $v['message_bytes'];
|
|
|
- $rows[$name]['messages_ready'] = $v['messages_ready'];
|
|
|
-
|
|
|
- $rows[$name]['consumers_count'] = $v['consumers'];
|
|
|
- $rows[$name]['auto_delete'] = $v['auto_delete'];
|
|
|
- $rows[$name]['durable'] = $v['durable'];
|
|
|
-
|
|
|
- $rows[$name]['state'] = $v['state'];
|
|
|
- $rows[$name]['idle_since'] = $v['idle_since'];
|
|
|
- }
|
|
|
- unset($result);
|
|
|
|
|
|
- return ['count' => count($rows), 'rows' => $rows];
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+ * [获取消息列表]
|
|
|
+ * @author: libingke
|
|
|
+ */
|
|
|
+ public function getTopicList()
|
|
|
+ {
|
|
|
+ $authStr = Yii::$app->Amqp->user . ':' . Yii::$app->Amqp->pass;
|
|
|
+ $url = Yii::$app->Amqp->host . ':' . Yii::$app->Amqp->api_port . "/api/exchanges";
|
|
|
+
|
|
|
+ $curl = new Curl();
|
|
|
+ $curl->setOption(CURLOPT_USERPWD, $authStr);
|
|
|
+ $result = json_decode($curl->get($url), true);
|
|
|
+
|
|
|
+
|
|
|
+ if ($curl->responseCode != 200)
|
|
|
+ throw new Exception(1002);
|
|
|
+
|
|
|
+ if ($curl->errorText)
|
|
|
+ throw new Exception(1002, $curl->errorText);
|
|
|
+
|
|
|
+ if (isset($result['error']) && is_string($result['error']))
|
|
|
+ throw new Exception(1002, $result['error']);
|
|
|
+
|
|
|
+ $rows = [];
|
|
|
+ foreach ($result as $k => $v) {
|
|
|
+ if($v['type'] = 'topic'){
|
|
|
+ $name = $v['name'];
|
|
|
+ $rows[$name]['name'] = $name;
|
|
|
+ $rows[$name]['auto_delete'] = $v['auto_delete'];
|
|
|
+ $rows[$name]['durable'] = $v['durable'];
|
|
|
+ $rows[$name]['arguments'] = $v['arguments'];
|
|
|
+ $rows[$name]['type'] = $v['type'];
|
|
|
+ $rows[$name]['vhost'] = $v['vhost'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ unset($result);
|
|
|
+
|
|
|
+ return ['count' => count($rows), 'rows' => $rows];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|