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