Download the PHP package haozu/delay-queue without Composer

On this page you can find all versions of the php package haozu/delay-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 delay-queue

delay-queue

Downloads license Release

基于Redis实现的延迟队列,MsgPack编码数据 参考有赞延迟队列设计实现

应用场景

支付宝异步通知实现

支付宝异步通知时间间隔是如何实现的(通知的间隔频率一般是:2m,10m,10m,1h,2h,6h,15h)  

订单支付成功后, 生成通知任务, 放入消息队列中.
任务内容包含Array{0,0,2m,10m,10m,1h,2h,6h,15h}和通知到第几次N(这里N=1, 即第1次).
消费者从队列中取出任务, 根据N取得对应的时间间隔为0, 立即发送通知.

第1次通知失败, N += 1 => 2
从Array中取得间隔时间为2m, 添加一个延迟时间为2m的任务到延迟队列, 任务内容仍包含Array和N

第2次通知失败, N += 1 => 3, 取出对应的间隔时间10m, 添加一个任务到延迟队列, 同上
......
第7次通知失败, N += 1 => 8, 取出对应的间隔时间15h, 添加一个任务到延迟队列, 同上
第8次通知失败, N += 1 => 9, 取不到间隔时间, 结束通知

实现原理

利用Redis的有序集合,member为JobId, score为任务执行的时间戳,
每秒扫描一次集合,取出执行时间小于等于当前时间的任务.

依赖

下载

releases

composer安装

添加任务

参数说明

参数名 类型 含义 备注
topic string 一组相同类型Job的集合(队列)。 供消费者来订阅。
jobName string job任务的类名,是延迟队列里的基本单元。 与具体的Topic关联在一起。
delay int Job需要延迟的时间, 单位:秒
ttr int Job执行超时时间, 单位:秒 保证job至少被消费一次获取job后超时未处理会重新投入队列
args string Job的参数内容,供消费者做具体的业务处理, 可选参数
id string Job唯一标识 需确保JobID唯一 可选参数

其他例子


All versions of delay-queue with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-pcntl Version *
ext-msgpack Version *
psr/container Version ^1.0
monolog/monolog Version ^1.0
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 haozu/delay-queue contains the following files

Loading the files please wait ....