格式化消息以排队的最佳方法是什么? [英] What is the best way to format messages for queueing?

查看:80
本文介绍了格式化消息以排队的最佳方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在阅读消息队列,我想为我的应用程序实现一个简单,可扩展的系统.尽管在那里有很多关于建立MQ系统的很好的信息,但是我找不到关于实际实现的很多信息.

我正在寻找有关如何正确格式化队列消息格式以及在PHP中执行作业的方式和最佳实践.我应该使用JSON,序列化的对象,文本,URL还是XML?我应该发送什么信息?是采用switch($job['command']) {}(或类似方式)的工作人员走的路,还是那里有建立的模式来实施工作人员?

非常感谢您的帮助!

解决方案

您可以在PHP中选择以下任何MQ实现,因此您不必自己动手,也可以查看其源代码以了解其源代码.执行.对于常规集成,请查看有关企业集成模式的ActiveMQ页面. /p>

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

    一个用于beantalkd的PHP客户端库. BeanStalk允许PHP开发人员使用Beantalkd内存工作队列服务器( http://xph.us/software/beanstalkd ).

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

    Beanstalk是一种简单,快速的工作队列服务.它的界面是通用的,但最初旨在通过异步运行耗时的任务来减少大容量Web应用程序中页面浏览的延迟.

  • http://activemq.apache.org/

    Apache ActiveMQ是最流行和功能最强大的开源消息传递和集成模式提供程序. Apache ActiveMQ速度很快,支持许多跨语言客户端和协议,具有易于使用的企业集成模式和许多高级功能,同时完全支持JMS 1.1和J2EE 1.4. Apache ActiveMQ是根据Apache 2.0许可发布的.

  • http://memcachedb.org/memcacheq/

    Memcachedb是专为持久性而设计的分布式键值存储系统.它不是高速缓存解决方案,而是用于高频写入和读取的持久性存储.它符合内存缓存协议(未完成,请参见下文),因此任何内存缓存客户端都可以与其建立连接. Memcachedb使用Berkeley DB作为存储后端,因此支持许多功能,包括事务和复制.

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

    Zend Server 5.0集成了Job Queue,为创建,执行和管理作业提供了全面支持,以优化应用程序性能并减少服务器负载,最大程度地减少应用程序瓶颈并改善最终用户体验.

  • https://www.dropr.org/

    dropr是用PHP编写的分布式消息队列框架.主要目标是:

      通过网络进行
    • 可靠且持久的(故障安全)消息
    • 没有单个(故障点)服务器实例的分散式架构
    • 易于设置和使用
    • 队列存储和消息传输的模块化(当前已实现文件系统存储和curl-upload)

  • http://gearman.org/

    Gearman提供了一个通用的应用程序框架,可以将工作分配到更适合执行该工作的其他机器或进程.它允许您并行执行工作,进行负载平衡处理以及在语言之间调用函数.

  • http://www.zeromq.org/

    ØMQ(也拼写为ZeroMQ,0MQ或ZMQ)是一种高性能的异步消息传递库,旨在用于可伸缩的分布式或并发应用程序中.它提供了一个消息队列,但是与面向消息的中间件不同,ØMQ系统可以在没有专用消息代理的情况下运行.该库旨在具有熟悉的套接字样式API.

I've been reading up on message queueing lately, and I'd like to implement a simple, extendable, system for my app. While there's a lot of good information on the subject of setting up a MQ system out there, I can't find a lot about the actual implementation.

I'm looking for patterns and best practices on how to properly format messages for a queue, and ways to execute the jobs in PHP. Should I use JSON, serialized objects, text, URLs or XML? What information should I send? Is a worker with a switch($job['command']) {} (or something like that) the way to go, or are there any established patterns out there to implement a worker?

Help greatly appreciated!

解决方案

You can pick any of the following MQ implementations in PHP, so you don't have to roll your own and you can look at their sourcecode to learn about their implementation. For general integration, have a look at the 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 (http://xph.us/software/beanstalkd).

  • 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.

这篇关于格式化消息以排队的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆