初始化
parent
f3349ffb84
commit
60b0249376
|
@ -12,7 +12,7 @@ use Hyperf\Amqp\Message\Type;
|
||||||
use Hyperf\Amqp\Builder\QueueBuilder;
|
use Hyperf\Amqp\Builder\QueueBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Consumer(name="IM信息消费")
|
* @Consumer(name="IM信息消费",enable=true)
|
||||||
*/
|
*/
|
||||||
class ImMessageConsumer extends ConsumerMessage
|
class ImMessageConsumer extends ConsumerMessage
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,9 @@ class ImMessageConsumer extends ConsumerMessage
|
||||||
*/
|
*/
|
||||||
public $routingKey = 'consumer:im:message';
|
public $routingKey = 'consumer:im:message';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ImMessageConsumer constructor.
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->setQueue('im:message:queue:'.config('ip_address'));
|
$this->setQueue('im:message:queue:'.config('ip_address'));
|
||||||
|
@ -76,8 +79,10 @@ class ImMessageConsumer extends ConsumerMessage
|
||||||
return Result::ACK;
|
return Result::ACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isEnable(): bool
|
/**
|
||||||
{
|
* @param $data
|
||||||
return true; // TODO: Change the autogenerated stub
|
*/
|
||||||
|
public function getClientFds($data){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,14 @@ class DemoProducer extends ProducerMessage
|
||||||
|
|
||||||
public function __construct($data)
|
public function __construct($data)
|
||||||
{
|
{
|
||||||
|
$message = [
|
||||||
|
'method'=>'', //
|
||||||
|
'sender'=>'', // 发送者
|
||||||
|
'receive'=>'', // 接收者
|
||||||
|
'receiveType'=>'',
|
||||||
|
'message'=>[]
|
||||||
|
];
|
||||||
|
|
||||||
$this->payload = $data;
|
$this->payload = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,6 @@ namespace App\Controller;
|
||||||
|
|
||||||
use Hyperf\HttpServer\Contract\ResponseInterface;
|
use Hyperf\HttpServer\Contract\ResponseInterface;
|
||||||
|
|
||||||
use Hyperf\Amqp\Producer;
|
|
||||||
use App\Amqp\Producer\DemoProducer;
|
|
||||||
|
|
||||||
class IndexController extends AbstractController
|
class IndexController extends AbstractController
|
||||||
{
|
{
|
||||||
public function index(ResponseInterface $response)
|
public function index(ResponseInterface $response)
|
||||||
|
@ -23,9 +20,6 @@ class IndexController extends AbstractController
|
||||||
$user = $this->request->input('user', 'Hyperf');
|
$user = $this->request->input('user', 'Hyperf');
|
||||||
$method = $this->request->getMethod();
|
$method = $this->request->getMethod();
|
||||||
|
|
||||||
$producer = container()->get(Producer::class);
|
|
||||||
$producer->produce(new DemoProducer('test'. date('Y-m-d H:i:s')));
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'method' => $method,
|
'method' => $method,
|
||||||
'message' => "Hello {$user}."
|
'message' => "Hello {$user}."
|
||||||
|
|
|
@ -40,7 +40,7 @@ return [
|
||||||
],
|
],
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'enable_coroutine' => true,
|
'enable_coroutine' => true,
|
||||||
'worker_num' => 1,
|
'worker_num' => swoole_cpu_num(),
|
||||||
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
|
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
|
||||||
'open_tcp_nodelay' => true,
|
'open_tcp_nodelay' => true,
|
||||||
'max_coroutine' => 100000,
|
'max_coroutine' => 100000,
|
||||||
|
@ -48,6 +48,7 @@ return [
|
||||||
'max_request' => 100000,
|
'max_request' => 100000,
|
||||||
'socket_buffer_size' => 3 * 1024 * 1024,
|
'socket_buffer_size' => 3 * 1024 * 1024,
|
||||||
'buffer_output_size' => 3 * 1024 * 1024,
|
'buffer_output_size' => 3 * 1024 * 1024,
|
||||||
|
'package_max_length'=> 10 * 1024 * 1024,
|
||||||
],
|
],
|
||||||
'callbacks' => [
|
'callbacks' => [
|
||||||
SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
SwooleEvent::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],
|
||||||
|
|
|
@ -15,15 +15,16 @@
|
||||||
|
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var func = function () {
|
var func = function () {
|
||||||
if (i >= 20) {return;}
|
if (i >= 2000) {return;}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://47.105.180.123:9503/upload',
|
url: 'http://127.0.0.1:9503/upload',
|
||||||
data: fileData,
|
data: fileData,
|
||||||
dataType: 'json', //服务器返回json格式数据
|
dataType: 'json', //服务器返回json格式数据
|
||||||
type: 'post', //HTTP请求类型
|
type: 'post', //HTTP请求类型
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function () {
|
success: function () {
|
||||||
|
i++;
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue