纯PHP AMQP库
AMQP,即Advanced Message Queuing Protocol,一个提供统一消息服务的应用层标准高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计。基于此协议的客户端与消息中间件可传递消息,并不受客户端/中间件不同产品,不同的开发语言等条件的限制。Erlang中的实现有 RabbitMQ等。
abstract class AbstractChannel { const PROTOCOL_080 = '0.8'; const PROTOCOL_091 = '0.9.1'; public static $PROTOCOL_CONSTANTS_CLASS; public function __construct(AbstractConnection $connection, $channel_id) { $this->connection = $connection; $this->channel_id = $channel_id; $connection->channels[$channel_id] = $this; $this->frame_queue = array(); // Lower level queue for frames $this->method_queue = array(); // Higher level queue for methods $this->auto_decode = false; $this->msg_property_reader = new AMQPReader(null); $this->wait_content_reader = new AMQPReader(null); $this->dispatch_reader = new AMQPReader(null); $this->protocolVersion = self::getProtocolVersion(); switch ($this->protocolVersion) { case self::PROTOCOL_091: self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib\Wire\Constants091'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->debug = new DebugHelper($c); $this->amqp_protocol_header = $c::$AMQP_PROTOCOL_HEADER; $this->protocolWriter = new Protocol091(); $this->waitHelper = new Wait091(); $this->methodMap = new MethodMap091(); break; case self::PROTOCOL_080: self::$PROTOCOL_CONSTANTS_CLASS = 'PhpAmqpLib\Wire\Constants080'; $c = self::$PROTOCOL_CONSTANTS_CLASS; $this->debug = new DebugHelper($c); $this->amqp_protocol_header = $c::$AMQP_PROTOCOL_HEADER; $this->protocolWriter = new Protocol080(); $this->waitHelper = new Wait080(); $this->methodMap = new MethodMap080(); break; default: throw new AMQPRuntimeException(sprintf( 'Protocol: %s not implemented.', $this->protocolVersion )); } }
免责声明
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章
如何将 MySQL 数据库转储为纯文本 (CSV) 备份?
01Nov2024
使用 SQL 将 MySQL 数据库转储为纯文本 (CSV) 备份,而不是使用 mysqldump,后者以主要设计用于...的格式输出数据。
如何使用纯 PHP 创建 API?
04Nov2024
在这个项目中,我们将在任何框架中仅使用 PHP 创建一个简单的 API。我们所需要的只是: PHP - 必备 作曲家 - 必备 编辑器/IDE,如 VScode 或 PHPStorm Docker - 首选但不是必需的 邮差 - 预
Hot Tools
热门文章
崩坏:星穹铁道 - 所有金色替罪羊谜题解决方案
18Jan2025手游攻略
Tales Of Graces F 重制版:所有锁定的宝箱密码
18Jan2025手游攻略
鲁马岛:考古学家职业指南
03Jan2025手游攻略
如何修复 KB5049622 在 Windows 11 中安装失败的问题?
15Jan2025故障排查
鲁玛岛:所有鲁玛蛋地点
05Jan2025手游攻略