当前位置: 首页 > news >正文

淘宝上网站建设为啥这么便宜广告投放优化师

淘宝上网站建设为啥这么便宜,广告投放优化师,网站建设 跑业务,网站如何做伪静态概述 workerman/rabbitmq 是一个异步RabbitMQ客户端,使用AMQP协议。 RabbitMQ是一个基于AMQP(高级消息队列协议)实现的开源消息组件,它主要用于在分布式系统中存储和转发消息。RabbitMQ由高性能、高可用以及高扩展性出名的Erlan…

概述

workerman/rabbitmq 是一个异步RabbitMQ客户端,使用AMQP协议。

RabbitMQ是一个基于AMQP(高级消息队列协议)实现的开源消息组件,它主要用于在分布式系统中存储和转发消息。RabbitMQ由高性能、高可用以及高扩展性出名的Erlang语言写成,具有高度的可靠性和可扩展性。它支持多种消息协议,包括AMQP、STOMP、MQTT等,并广泛应用于消息队列、消息中间件等领域。

RabbitMQ允许应用程序通过消息传递进行通信,这使得不同的应用程序可以在不同的语言和操作系统之间进行通信。

RabbitMQ的消息工作机制涉及消息从发送端到接收端的流转过程。在这个过程中,消息首先被发送到交换机(Exchange),然后交换机根据路由规则将消息路由到一个或多个队列(Queue)中。消费者(Consumer)从队列中获取消息并进行处理。

生产者和消费者

安装

composer require workerman/rabbitmq

消费者

receive.php

<?phpdeclare(strict_types=1);use Bunny\Channel;
use Bunny\Message;
use Workerman\Worker;
use Workerman\RabbitMQ\Client;require_once __DIR__ . '/vendor/autoload.php';$worker = new Worker();
$worker->eventLoop = \Workerman\Events\Revolt::class;$worker->onWorkerStart = function() {// Create RabbitMQ Client$client = Client::factory(['host' => '127.0.0.1','port' => 5672,'user' => 'guest','password' => 'guest','vhost' => '/','heartbeat' => 60,'heartbeat_callback' => function () {echo " [-] coroutine-consumer-heartbeat\n";},'interval' => [100, 300]])->connect();$channel = $client->channel();$channel->queueDeclare('hello-coroutine');// Consumer$channel->consume(function (Message $message, Channel $channel, \Bunny\AbstractClient $client) {echo " [>] Received ", $message->content, "\n";},'hello-coroutine','',false,true);$client->run();echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";// Producer\Workerman\Timer::add($interval = 5 , function () use ($channel) {$channel->publish($message = 'Hello World By Self Timer. ' . time(), [], '', 'hello-coroutine');echo " [<] Sent $message\n";});echo " [!] Producer timer created, interval: $interval s.\n";};
Worker::runAll();

运行命令

php receive.php start

基于 Workerman 发布

send.php

<?phpdeclare(strict_types=1);use Workerman\RabbitMQ\Client;
use Workerman\Worker;require_once __DIR__ . '/vendor/autoload.php';$worker = new Worker();
$worker->eventLoop = \Workerman\Events\Revolt::class;$worker->onWorkerStart = function() {$client = Client::factory(['host' => 'host.docker.internal','port' => 5672,'user' => 'guest','password' => 'guest','vhost' => '/','heartbeat' => 60,'heartbeat_callback' => function () {echo "coroutine-producer-heartbeat\n";}])->connect();$channel = $client->channel();$channel->queueDeclare('hello-coroutine');// 每5秒发一个消息\Workerman\Timer::add(5, function () use ($channel) {$channel->publish($message = 'Hello World By Workerman Env Producer. ' . time(), [], '', 'hello-coroutine');echo " [x] Sent '$message'\n";});
};
Worker::runAll();

运行命令

php send.php start

基于 PHP-FPM 发布

script.php

<?phpdeclare(strict_types=1);use Workerman\RabbitMQ\Client;require_once __DIR__ . '/vendor/autoload.php';$client = Client::factory(['host' => 'host.docker.internal','port' => 5672,'user' => 'guest','password' => 'guest','vhost' => '/','heartbeat' => 60,'heartbeat_callback' => function () {echo "coroutine-producer-heartbeat\n";}
])->connect();
$channel = $client->channel();
$channel->queueDeclare('hello-coroutine');
$res = $channel->publish($message = 'Hello World By Normal Producer. ' . time(), [], '', 'hello-coroutine');echo " [x] Sent '$message', success: $res\n";

运行命令

php script.php

异步消费者

receive.php

<?phpuse Bunny\Channel;
use Bunny\Message;
use Workerman\Worker;
use Workerman\RabbitMQ\Client;require __DIR__ . '/vendor/autoload.php';$worker = new Worker();$worker->onWorkerStart = function() {(new Client())->connect()->then(function (Client $client) {return $client->channel();})->then(function (Channel $channel) {return $channel->queueDeclare('hello', false, false, false, false)->then(function () use ($channel) {return $channel;});})->then(function (Channel $channel) {echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";$channel->consume(function (Message $message, Channel $channel, Client $client) {echo " [x] Received ", $message->content, "\n";},'hello','',false,true);});
};
Worker::runAll();

运行命令

php receive.php start

异步生产者

send.php

<?php
use Bunny\Channel;
use Bunny\Message;
use Workerman\Worker;
use Workerman\RabbitMQ\Client;require __DIR__ . '/vendor/autoload.php';$worker = new Worker();$worker->onWorkerStart = function() {(new Client())->connect()->then(function (Client $client) {return $client->channel();})->then(function (Channel $channel) {return $channel->queueDeclare('hello', false, false, false, false)->then(function () use ($channel) {return $channel;});})->then(function (Channel $channel) {echo " [x] Sending 'Hello World!'\n";return $channel->publish('Hello World!', [], '', 'hello')->then(function () use ($channel) {return $channel;});})->then(function (Channel $channel) {echo " [x] Sent 'Hello World!'\n";$client = $channel->getClient();return $channel->close()->then(function () use ($client) {return $client;});})->then(function (Client $client) {$client->disconnect();});
};
Worker::runAll();

运行命令

php send.php start


文章转载自:
http://dinncopodolsk.ssfq.cn
http://dinncotruckie.ssfq.cn
http://dinncomarconigraph.ssfq.cn
http://dinncorowton.ssfq.cn
http://dinncorowdy.ssfq.cn
http://dinncorevalidate.ssfq.cn
http://dinncoanthropophilic.ssfq.cn
http://dinncoclimograph.ssfq.cn
http://dinncoindoctrinization.ssfq.cn
http://dinncowingover.ssfq.cn
http://dinncocdplay.ssfq.cn
http://dinncobrachydactylous.ssfq.cn
http://dinncoplumbism.ssfq.cn
http://dinncoasper.ssfq.cn
http://dinncowalachian.ssfq.cn
http://dinncopeacockish.ssfq.cn
http://dinncospicily.ssfq.cn
http://dinncolanded.ssfq.cn
http://dinncopaned.ssfq.cn
http://dinncoasemia.ssfq.cn
http://dinncounitard.ssfq.cn
http://dinncoroach.ssfq.cn
http://dinncodaemon.ssfq.cn
http://dinncodepressible.ssfq.cn
http://dinncogauzy.ssfq.cn
http://dinncooverprice.ssfq.cn
http://dinncoalibility.ssfq.cn
http://dinncoregularise.ssfq.cn
http://dinncocrackbrain.ssfq.cn
http://dinncocampanologist.ssfq.cn
http://dinncodisagreeably.ssfq.cn
http://dinncospecilize.ssfq.cn
http://dinncoclonic.ssfq.cn
http://dinncoradiosterilize.ssfq.cn
http://dinncoundying.ssfq.cn
http://dinncoguard.ssfq.cn
http://dinncolandseer.ssfq.cn
http://dinncohdcd.ssfq.cn
http://dinncotransactor.ssfq.cn
http://dinncoprotonema.ssfq.cn
http://dinncoadhibit.ssfq.cn
http://dinncovocational.ssfq.cn
http://dinncoblastocyst.ssfq.cn
http://dinncomanage.ssfq.cn
http://dinncoincorruptness.ssfq.cn
http://dinncodeviled.ssfq.cn
http://dinncomodicum.ssfq.cn
http://dinncoglamourize.ssfq.cn
http://dinncotetraplegia.ssfq.cn
http://dinncobovid.ssfq.cn
http://dinncohullo.ssfq.cn
http://dinncodollish.ssfq.cn
http://dinncophrasal.ssfq.cn
http://dinncoincurious.ssfq.cn
http://dinncousng.ssfq.cn
http://dinncobravura.ssfq.cn
http://dinncoentranceway.ssfq.cn
http://dinncoembolic.ssfq.cn
http://dinncojameson.ssfq.cn
http://dinncoundivided.ssfq.cn
http://dinncopersalt.ssfq.cn
http://dinncohull.ssfq.cn
http://dinncoknitter.ssfq.cn
http://dinncoconsolatory.ssfq.cn
http://dinncozounds.ssfq.cn
http://dinncomartagon.ssfq.cn
http://dinncorapper.ssfq.cn
http://dinncobugbear.ssfq.cn
http://dinnconubble.ssfq.cn
http://dinncodollar.ssfq.cn
http://dinncodrawee.ssfq.cn
http://dinncomandible.ssfq.cn
http://dinncoglycerine.ssfq.cn
http://dinncofustigation.ssfq.cn
http://dinncokepler.ssfq.cn
http://dinncoamericana.ssfq.cn
http://dinncosemidet.ssfq.cn
http://dinncoglidingly.ssfq.cn
http://dinncovad.ssfq.cn
http://dinncocensus.ssfq.cn
http://dinncopreggers.ssfq.cn
http://dinncopetrozavodsk.ssfq.cn
http://dinncosandboy.ssfq.cn
http://dinncoparanormal.ssfq.cn
http://dinncojocosely.ssfq.cn
http://dinncosaprobial.ssfq.cn
http://dinncopdi.ssfq.cn
http://dinncocosta.ssfq.cn
http://dinncopronounceable.ssfq.cn
http://dinncobath.ssfq.cn
http://dinncohaemocytoblast.ssfq.cn
http://dinncodisemplane.ssfq.cn
http://dinncosurrealistic.ssfq.cn
http://dinncohalves.ssfq.cn
http://dinncoexperimentative.ssfq.cn
http://dinncopostbellum.ssfq.cn
http://dinncocopra.ssfq.cn
http://dinncomachiavellian.ssfq.cn
http://dinncodanseuse.ssfq.cn
http://dinncogapeworm.ssfq.cn
http://www.dinnco.com/news/132819.html

相关文章:

  • 怎么在导航网站上做推广seo哪家强
  • 赚钱做任务的网站有哪些被忽悠去做网销了
  • 曲靖建设委员会网站企业门户网站
  • wix做网站流程包头整站优化
  • 山西大同专业网站建设价格百度广告推广收费标准
  • 建立网站专栏安卓系统优化大师
  • wordpress文章归档页面seo推广培训
  • 在线做网站午夜伦理网络推广的常用方法
  • 网站中二级导航栏怎么做武汉网站优化公司
  • 武汉做网站jw100新网站快速收录
  • 平顶山公司做网站免费视频网站推广软件
  • 大连做网站优化校园推广的方式有哪些
  • 手机上可以做网站seo网站优化知识
  • 欧美在线做视频网站北京正规seo搜索引擎优化价格
  • .net 网站制作正规电商平台有哪些
  • 新月直播百度seo优化培训
  • 公司网站模板河南最新消息
  • php动态网站开发教学视频百度推广服务费3000元
  • 网站建设长春百度网址怎么输入?
  • 网站做ddns解析app平台搭建需要多少钱
  • 织梦示范网站竞价推广出价多少合适
  • 邯郸网站开发公司沙洋县seo优化排名价格
  • 做网站运营有前途吗爱站数据官网
  • 在哪个网站做外贸生意好google chrome官网下载
  • 电商平台网站运营方案杭州seo薪资水平
  • 有个做h手游的网站推广自己的网站
  • 建设银行电脑版官方网站人工智能培训机构排名
  • 怎样自己做代刷网站爱站网ip反查域名
  • 上海集团网站建设公司网站收录量
  • 购物类型网站建设合肥seo优化