roryy/flatfishqueue 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

roryy/flatfishqueue

最新稳定版本:v0.6.1

Composer 安装命令:

composer require roryy/flatfishqueue

包简介

Queue Library for RabbitMQ or SQS

README 文档

README

PHP queue library for RabbitMQ. It's possible to add more queue types like SQS

Please do not use in production as BC breaks can occur before reaching version 1.0.

Installation

composer require roryy/trafficjam "0.6.*"

Usage

To use the Trafficjam library in combination with Rabbitmq, you have to setup your Rabbitmq credentials first.

Like this:

use Trafficjam\Infrastructure\RabbitMq\Connection;
use Trafficjam\Infrastructure\RabbitMq\RabbitMqQueue;

$connection = new Connection('localhost', 5672, 'guest', 'guest');

Then create a queue like this:

$queue = new RabbitMqQueue($connection, $queueName, $durable, $exchange, $routingKey);
$trafficjam = new Trafficjam($queue);

To publish one or more messages to your queue:

$trafficjam->publish('test 1');
$trafficjam->publish('test 2');

And consume (with a callback), don't forget to acknowledge

$trafficjam->consume(function (Consumable $msg) use ($trafficjam) {
    $message = $msg->getMessage();
    echo ' msg: '. $message .PHP_EOL;

    $trafficjam->acknowledge($msg);
});

This will output:

test 1
test 2

Future

In the future this library will also going to support SQS.

Contribute

If you want to use another queuing system besides RabbitMQ then please implement the Queue interface when creating your own. Please create a pull request.

License

Trafficjam is licensed under the MIT License. See the bundled LICENSE file for details.

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固