微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 格式化排队消息的最佳方法是什么?

我最近一直在阅读消息排队,我想为我的应用程序实现一个简单,可扩展的系统.虽然关于设置MQ系统的主题有很多很好的信息,但我找不到很多关于实际实现的信息.

我正在寻找关于如何正确格式化队列消息的模式和最佳实践,以及在PHP中执行作业的方法.我应该使用JSON,序列化对象,文本,URL还是XML?我应该发送什么信息?工作者是否有一个开关($job [‘command’]){}(或类似的东西)的方法,或者是否有任何已建立的模式来实现工人?

非常感谢!

您可以在PHP中选择以下任何MQ实现,因此您不必自己动手,您可以查看其源代码以了解它们的实现.对于一般集成,请看一下 ActiveMQ page on Enterprise Integration patterns.

> http://sourceforge.net/projects/beanstalk/

A PHP Client Library for beanstalkd. BeanStalk allows PHP developers to make use of the beanstalkd in-memory workqueue server (07002).

> http://kr.github.com/beanstalkd/

Beanstalk is a simple,fast workqueue service. Its interface is generic,but was originally designed for reducing the latency of page views in high-volume web applications by running time-consuming tasks asynchronously.

> http://activemq.apache.org/

Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns provider. Apache ActiveMQ is fast,supports many Cross Language Clients and Protocols,comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License

> http://memcachedb.org/memcacheq/

Memcachedb is a distributed key-value storage system designed for persistent. It is not a cache solution,but a persistent storage for high-frequency writing and reading. It conforms to memcache protocol(not completed,see below),so any memcached client can have connectivity with it. Memcachedb uses Berkeley DB as a storing backend,so lots of features including transaction and replication are supported.

> http://www.zend.com/en/products/server/

Zend Server 5.0 incorporates Job Queue,providing full support for creating,executing and managing jobs to optimize application performance and reduce server load,minimizing application bottlenecks and improving the end-user experience.

> https://www.dropr.org/

dropr is a distributed message queue framework written in PHP. The main goals are:

  • reliable and durable (failsafe)-messaging over networks
  • decentralized architecture without a single (point of failure) server instance
  • easy to setup and use
  • modularity for queue storage and message transports (currently filesystem storage and curl-upload are implemented)

> http://gearman.org/

Gearman provides a generic application framework to farm out work to other machines or processes that are better suited to do the work. It allows you to do work in parallel,to load balance processing,and to call functions between languages.

> http://www.zeromq.org/

ØMQ (also spelled ZeroMQ,0MQ or ZMQ) is a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue,but unlike message-oriented middleware,a ØMQ system can run without a dedicated message broker. The library is designed to have a familiar socket-style API.

原文地址:https://www.jb51.cc/php/137412.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐