Download the PHP package bang/queue without Composer

On this page you can find all versions of the php package bang/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package queue

bang-queue for ThinkPHP8

描述

基于 workerman + thinkphp8 + redis,实现的一个任务队列

安装

composer require bang/queue

配置

配置文件位于 config/bang_queue.php

配置说明

仅支持Redis驱动,没有Redis请自行安装

配置解释

default , 对应 options 下的连接配置

count,开启的消费者的进程数,按照自己服务器配置来衡量

isDynamic ,是否需要动态监听。懒人必备,这样不必去配置listenList了。有一定的性能消耗

processPort ,开启动态监听时,需要启动一个端口来监听。请确保你设置的端口没被占用。默认是 9500

loggerChannel ,日志通道。具体请看thinkphp8手册的日志处理。留空则获取它默认的配置通道

config ,是workerman的一个日志、pid、stdoutFile的一些配置。一般来说不需要做过多的修改

  • pidFileName ,pid文件名
  • path ,这些配置存储的目录。相对于项目的根目录
  • stdoutFile ,stdoutFile文件名
  • logFile ,日志文件名

options,连接列表,里面可以配置各种连接,不过这些必须都是Redis的配置

  • host ,Redis链接
  • port ,端口
  • password ,密码。如没设置,留空即可
  • select ,select 的 database。可以有效避免和别的业务冲突
  • prefix ,前缀,一般留空即可
  • max_attempts ,消费失败后,重试次数
  • retry_seconds ,重试间隔,单位秒。

重试说明

创建任务类

任务类 必须 implements bang\queue\Consumer

以下写一个例子

发布任务

第一个,bang\queue\Queue::send($queueName , $data, $delay = 0)

第二个,bang\queue\Queue::sendDynamic($class , $data, $delay = 0)

第一个命令说明

$queueName,队列名,优先获取 配置中的 listenList的映射 $data,需要传输到消费者中的参数 $delay,意思在n秒后执行,传0或不传,就是立即执行

第一个命令说明

$queueName,具体的消费者类路径,例子:可以传 app\queue\test\Consume 或者 app\queue\test\Consume::class。用这种方法,消费者类最好定义好static $queue的队列名 $data,需要传输到消费者中的参数 $delay,意思在n秒后执行,传0或不传,就是立即执行

监听任务并执行

如果需要进程常驻,则可以运行 &> php think bang_queue:work start -d true

两种,具体的可选参数可以输入命令加 --help 查看

注意事项

为了在长时间中,mysql有断开的风险。建议在 database.php配置文件中 break_reconnect 设置成 true。也就是支持断线重连功能。

有问题请联系 邮箱:[email protected]


All versions of queue with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
topthink/framework Version ^8.0
workerman/redis-queue Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bang/queue contains the following files

Loading the files please wait ...