定制 slims/queue 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

slims/queue

最新稳定版本:v1.0.0

Composer 安装命令:

composer require slims/queue

包简介

SLiMS Library to manage asyncronous task with message broker

README 文档

README

A SLiMS component to manage queue processes. You can provide your handler, please read handler standart in src/Handlers/.

How to

install

composer require slims/queue

Produce

use SLiMS\Queue\Manager as Queue;

Queue::produce('your message/formatter task etc'); // default topic is slims

// or 

Queue::produce('your message/formatter task etc', topic: 'csv_process');

Consume

use SLiMS\Queue\Manager as Queue;

Queue::consume(topic: 'slims', callback: function($message){
    // write your code here
});

// with channel name

Queue::setChannel('worker1')->consume(topic: 'slims', callback: function($message){
    // write your code here
});

Config

Queue config available in config/queue.php

<?php

return [
    'default_handler' => 'database', // change it with yours. e.g : nsq
    'default_topic' => 'slims',
    'handlers' => [
        'database' => [
            'class' => \SLiMS\Queue\Handlers\Database::class,
            'options' => [
                'table' => 'queue',
                'order' => 'asc',
                'sort_by' => 'created_at',
                'delay_per_job' => 5 // in second
            ]
        ],
        /*'nsq' => [
            'class' => your_handler::class,
            'options' => [
                // your options here, such as host etc
            ]
        ]*/
    ]
];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2024-01-08