1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- /**
- * @link http://www.yiiframework.com/
- * @copyright Copyright (c) 2008 Yii Software LLC
- * @license http://www.yiiframework.com/license/
- */
- namespace console\controllers;
- use yii\console\Controller;
- use components\PhpClient;
- use PhpAmqpLib\Message\AMQPMessage;
- use PhpAmqpLib\Connection\AMQPStreamConnection;
- /**
- * This command echoes the first argument that you have entered.
- *
- * This command is provided as an example for you to learn how to create console commands.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @since 2.0
- */
- class MqController extends Controller
- {
- /**
- * This command echoes what you have entered as the message.
- * @param string $message the message to be echoed.
- */
- public function actionIndex($message = 'rabbit mq begin')
- {
- echo $message . "\n";
- $client = new PhpClient();
- $responses = $client->call('mq begin'); //在这里传入发送给服务端脚本的内容
- }
- /**
- * This command echoes what you have entered as the message.
- * @param string $message the message to be echoed.
- */
- public function actionReceive($message = 'rabbit mq Receive')
- {
- $client = new PhpClient();
- $responses = $client->call('direct type test','logs'); //在这里传入发送给服务端脚本的内容
- var_dump("Receive Message OK");
- }
- /**
- * This command echoes what you have entered as the message.
- * @param string $message the message to be echoed.
- */
- public function actionSend($message = 'rabbit mq send')
- {
- echo $message . "\n";
- $client = new PhpClient();
- $responses = $client->call('direct type test','logs'); //在这里传入发送给服务端脚本的内容
- var_dump("Send Message OK");
- }
- }
|