2017 © Pedro Peláez
 

library rabbitmq-event

the zwei rabbitmq event package.

image

zwei/rabbitmq-event

the zwei rabbitmq event package.

  • Wednesday, July 25, 2018
  • by smilehaha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

RabbitMQ Event

查看大图 Event RabbitMQ流程图, (*1)

# 安装(Install)

### 1步 通过Composer安装

通过 Composer 安装 如果还没有安装 Composer,你可以按 getcomposer.org 中的方法安装, (*2)

### 2步 创建composer写入内容

创建composer.json文件,并写入以下内容, (*3)

{
    "require": {
        "zwei/rabbitmq-event": "dev-master"
    },
    "minimum-stability": "dev"
}

### 3步 安装

composer install

事件格式

{
    "_id":"1528597263-0.0.0.0-2988-2",
    "eventKey":"event_demo_user_register_success",
    "data":{
        "date":"2018-06-10 10:21:03",
        "runId":2
    },
    "ip":"0.0.0.0"
}

运行脚本

网关分发

# 网关分发
php zwei-rabbitmq-event-gateway-service

普通队列消费事件

# 普通队列
php zwei-rabbitmq-event-standard-service rabbit_queue_single

发送测试事件脚本

php zwei-rabbitmq-event-send-test-event-message 事件key 运行次数(-1: 一直运行) 间隔时间(默认1秒), (*4)

# 发送测试事件
php zwei-rabbitmq-event-send-test-event-message 事件key 运行次数(-1: 一直运行) 间隔时间(默认1秒)
php zwei-rabbitmq-event-send-test-event-message event_demo_user_register_success -1 1 # 一直运行脚本,每秒发送一次事件
php zwei-rabbitmq-event-send-test-event-message event_demo_user_register_success 2 0 # 运行2次脚本,连续发送事件

Mongodb操作

db.getCollection("event_log").find({}).sort({"_id": -1});

# 查询"event_user_register"事件
db.getCollection("event_log").find({"eventKey": "event_user_register"}).pretty().sort({"_id": -1}).limit(100);

单元测试

# 发送Console事件
php vendor/phpunit/phpunit/phpunit --bootstrap vendor/autoload.php src/Tests/Queue/Services/GatewayServiceTest.php --filter testSendEventKeyEventConsole
# 发送非法事件
php vendor/phpunit/phpunit/phpunit --bootstrap vendor/autoload.php src/Tests/Queue/Services/GatewayServiceTest.php --filter testSendEventKeyEventNotFund
# 发送注册消息
php vendor/phpunit/phpunit/phpunit --bootstrap vendor/autoload.php src/Tests/Queue/Services/GatewayServiceTest.php --filter testSendEventKeyEventUserRegister

The Versions

25/07 2018

dev-master

9999999-dev https://github.com/qq1060656096/rabbitmq-event

the zwei rabbitmq event package.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Zhao Wei Jie

rabbitmq event