ThinkPHP6+Redis+think-queue+Supervisor实现进程常驻消息队列

thinkPHP/fastadmin topthink/think-queue 多进程 thinkPHP topthink/think-queue supervisor redis 多进程 阅读详情

前言

为了实现订单超时删除功能,使用到think-queue队列,本文记录安装和使用think-php,Redis及进程常驻Supervisor。

thinkphp-queue 是thinkphp 官方提供的一个消息队列服务,它支持消息队列的一些基本特性:

  • 消息的发布,获取,执行,删除,重发,失败处理,延迟执行,超时控制等
  • 队列的多队列, 内存限制 ,启动,停止,守护等
  • 消息队列可降级为同步执行

安装ThinkPHP6

使用composer安装。

composer create-project topthink/think tp

安装think-queue

在ThinkPHP6的安装目录下输入下面命令安装。

composer require topthink/think-queue

安装Redis

  • 下载Redis,可以从官网下载redis,本文以redis-6.0.6为例。
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
tar xvf redis-6.0.6.tar.gz
  • 编译并安装Redis
    编译时使用make MALLOC=libc编译,使用make编译时可能会报找不到jemalloc/jemalloc.h的错误,或者think-queue使用redis驱动时无法工作。为此坑曾经付出了2天时间的代价。
cd redis-6.0.6
make MALLOC=libc
make install

配置Redis并启动Redis服务

  • 配置conf,将redis.conf里的“daemonize no”改为“daemonize yes”,让redis在后台运行
mkdir /etc/redis
cp redis-6.0.6/redis.conf /etc/redis/redis.conf
#将redis.conf里的“daemonize no”改为“daemonize yes”,让redis在后台运行。
  • 启动redis
redis-server /etc/redis/redis.conf #启动redis服务
  • 查看redis服务是否运行
ps -ef |grep redis #查看redis是否运行
  • 停止redis
redis-cli shutdown #停止redis服务

安装phpredis

PHP使用Redis需要安装Redis扩展库phpredis,最好下载发布版本。本文以5.3.1为例。

  • 下载phpredis
wget https://github.com/phpredis/phpredis/archive/5.3.1.tar.gz
tar xvf 5.3.1.tar.gz
  • 编译phpredis
phpize
whereis php-config  #命令返回 php-config: /opt/lampp/bin/php-config,下一步要用
./configure --with-php-config=/opt/lampp/bin/php-config  #设置php-config
make
make install
  • php添加redis扩展
    在php.ini里增加redis.so。然后可以从phpinfo查看是否有
echo "extension=redis.so" >> /opt/lampp/etc/php.ini
php -i | grep redis #查看是否支持redis扩展

创建消息队列任务

  • 配置消息队列,将config/queue.php将’default’ => ‘sync’改为’default’ => ‘redis’,使用Redis驱动。
php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <448901948@qq.com>
// +----------------------------------------------------------------------

return [
    'default'     => 'redis',
    'connections' => [
        'sync'     => [
            'type' => 'sync',
        ],
        'database' => [
            'type'  => 'database',
            'queue' => 'default',
            'table' => 'jobs',
        ],
        'redis'    => [
            'type'       => 'redis',
            'queue'      => 'default',
            'host'       => '127.0.0.1',
            'port'       => 6379,
            'password'   => '',
            'select'     => 0,
            'timeout'    => 0,
            'persistent' => false,
        ],
    ],
    'failed'      => [
        'type'  => 'none',
        'table' => 'failed_jobs',
    ],
];
  • 队列生产者
    修改app/controller/Index.php里使用Queue::later或者Queue::push发布任务。
<?php

namespace app\controller;

use app\BaseController;
use think\facade\Queue;

class Index extends BaseController
{
    public function index()
    {
         $jobHander = 'app\job\Job';
         $jobData = ['ts' => time()];
         //入队列,later延时发送,单位秒。push立即发送,其他配置请参考[thinkphp-queue]
         Queue::later(2, $jobHander, $jobData);
        return '<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }</style><div style="padding: 24px 48px;"> <h1>:) </h1><p> ThinkPHP V' . \think\facade\App::version() . '<br/><span style="font-size:30px;">14载初心不改 - 你值得信赖的PHP框架</span></p><span style="font-size:25px;">[ V6.0 版本由 <a href="https://www.yisu.com/" target="yisu">亿速云</a> 独家赞助发布 ]</span></div><script type="text/javascript" src="https://tajs.qq.com/stats?sId=64890268" charset="UTF-8"></script><script type="text/javascript" src="https://e.topthink.com/Public/static/client.js"></script><think id="ee9b1aa918103c4fc"></think>';
    }

    public function hello($name = 'ThinkPHP6')
    {
        return 'hello,' . $name;
    }
}
  • 消费者和删除。
    在app目录下创建job文件夹,并创建Job1.php类。内容如下
<?php

namespace app\job;

use think\facade\Log;
use think\queue\Job;

class Job1
{
    public function fire(Job $job, $data)
    {
    	//在此执行具体任务,示例只简单打印执行次数
        $count = $job->attempts();
        Log::write('run the ' . $count . ' round');
        //如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
        $job->delete();
        // 也可以重新发布这个任务,此为延时2秒发布
        $job->release(2);
    }
}

监听任务并执行

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

php think queue:listen
php think queue:work

发布任务

在浏览器里输入http://localhost就可发布任务,此时从日志里看到输出的日志信息。

至此think-queue的功能已经完全实现,然而监听任务需要手动输入命令。而且如果服务器出现问题导致监听退出得需要手动再次启动。think-queue有提到配合supervisor使用,保证进程常驻,于是也使用supervisor让其保持进程常驻。

安装Supervisor

yum install epel-release
yum install -y supervisor
//设置开机自动启动
systemctl enable supervisord

配置Supervisor

; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
;  - Shell expansion ("~" or "$HOME") is not supported.  Environment
;    variables can be expanded using this syntax: "%(ENV_HOME)s".
;  - Quotes around values are not supported, except in the case of
;    the environment= options as shown below.
;  - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
;  - Command will be truncated if it looks like a config file comment, e.g.
;    "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
;
; Warning:
;  Paths throughout this example file use /tmp because it is available on most
;  systems.  You will likely need to change these to locations more appropriate
;  for your system.  Some systems periodically delete older files in /tmp.
;  Notably, if the socket file defined in the [unix_http_server] section below
;  is deleted, supervisorctl will be unable to connect to supervisord.

[unix_http_server]
file=/tmp/supervisor.sock   ; the path to the socket file
;chmod=0700                 ; socket file mode (default 0700)
;chown=nobody:nogroup       ; socket file uid:gid owner
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)

; Security Warning:
;  The inet HTTP server is not enabled by default.  The inet HTTP server is
;  enabled by uncommenting the [inet_http_server] section below.  The inet
;  HTTP server is intended for use within a trusted environment only.  It
;  should only be bound to localhost or only accessible from within an
;  isolated, trusted network.  The inet HTTP server does not support any
;  form of encryption.  The inet HTTP server does not use authentication
;  by default (see the username= and password= options to add authentication).
;  Never expose the inet HTTP server to the public internet.

;[inet_http_server]         ; inet (TCP) server disabled by default
;port=127.0.0.1:9001        ; ip_address:port specifier, *:port for all iface
;username=user              ; default is no username (open server)
;password=123               ; default is no password (open server)

[supervisord]
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB        ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10           ; # of main logfile backups; 0 means none, default 10
loglevel=info                ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false               ; start in foreground if true; default false
silent=false                 ; no logs to stdout if true; default false
minfds=1024                  ; min. avail startup file descriptors; default 1024
minprocs=200                 ; min. avail process descriptors;default 200
;umask=022                   ; process file creation umask; default 022
;user=supervisord            ; setuid to this UNIX account at startup; recommended if root
;identifier=supervisor       ; supervisord identifier, default is 'supervisor'
;directory=/tmp              ; default is not to cd during start
;nocleanup=true              ; don't clean up tempfiles at start; default false
;childlogdir=/tmp            ; 'AUTO' child log dir, default $TEMP
;environment=KEY="value"     ; key value pairs to add to environment
;strip_ansi=false            ; strip ansi escape codes in logs; def. false

; The rpcinterface:supervisor section must remain in the config file for
; RPC (supervisorctl/web interface) to work.  Additional interfaces may be
; added by defining them in separate [rpcinterface:x] sections.

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

; The supervisorctl section configures how supervisorctl will connect to
; supervisord.  configure it match the settings in either the unix_http_server
; or inet_http_server section.

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
;username=chris              ; should be same as in [*_http_server] if set
;password=123                ; should be same as in [*_http_server] if set
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history  ; use readline history if available

; The sample program section below shows all possible program subsection values.
; Create one or more 'real' program: sections to be able to control them under
; supervisor.

;[program:theprogramname]
;command=/bin/cat              ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1                    ; number of processes copies to start (def 1)
;directory=/tmp                ; directory to cwd to before exec (def no cwd)
;umask=022                     ; umask for process (default None)
;priority=999                  ; the relative start priority (default 999)
;autostart=true                ; start at supervisord start (default: true)
;startsecs=1                   ; # of secs prog must stay up to be running (def. 1)
;startretries=3                ; max # of serial start failures when starting (default 3)
;autorestart=unexpected        ; when to restart if exited after running (def: unexpected)
;exitcodes=0                   ; 'expected' exit codes used with autorestart (default 0)
;stopsignal=QUIT               ; signal used to kill process (default TERM)
;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false             ; send stop signal to the UNIX process group (default false)
;killasgroup=false             ; SIGKILL the UNIX process group (def false)
;user=chrism                   ; setuid to this UNIX account to run the program
;redirect_stderr=true          ; redirect proc stderr to stdout (default false)
;stdout_logfile=/a/path        ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10     ; # of stdout logfile backups (0 means none, default 10)
;stdout_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false   ; emit events on stdout writes (default false)
;stdout_syslog=false           ; send stdout to syslog with process name (default false)
;stderr_logfile=/a/path        ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10     ; # of stderr logfile backups (0 means none, default 10)
;stderr_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
;stderr_events_enabled=false   ; emit events on stderr writes (default false)
;stderr_syslog=false           ; send stderr to syslog with process name (default false)
;environment=A="1",B="2"       ; process environment additions (def no adds)
;serverurl=AUTO                ; override serverurl computation (childutils)

; The sample eventlistener section below shows all possible eventlistener
; subsection values.  Create one or more 'real' eventlistener: sections to be
; able to handle event notifications sent by supervisord.

;[eventlistener:theeventlistenername]
;command=/bin/eventlistener    ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1                    ; number of processes copies to start (def 1)
;events=EVENT                  ; event notif. types to subscribe to (req'd)
;buffer_size=10                ; event buffer queue size (default 10)
;directory=/tmp                ; directory to cwd to before exec (def no cwd)
;umask=022                     ; umask for process (default None)
;priority=-1                   ; the relative start priority (default -1)
;autostart=true                ; start at supervisord start (default: true)
;startsecs=1                   ; # of secs prog must stay up to be running (def. 1)
;startretries=3                ; max # of serial start failures when starting (default 3)
;autorestart=unexpected        ; autorestart if exited after running (def: unexpected)
;exitcodes=0                   ; 'expected' exit codes used with autorestart (default 0)
;stopsignal=QUIT               ; signal used to kill process (default TERM)
;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false             ; send stop signal to the UNIX process group (default false)
;killasgroup=false             ; SIGKILL the UNIX process group (def false)
;user=chrism                   ; setuid to this UNIX account to run the program
;redirect_stderr=false         ; redirect_stderr=true is not allowed for eventlisteners
;stdout_logfile=/a/path        ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10     ; # of stdout logfile backups (0 means none, default 10)
;stdout_events_enabled=false   ; emit events on stdout writes (default false)
;stdout_syslog=false           ; send stdout to syslog with process name (default false)
;stderr_logfile=/a/path        ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10     ; # of stderr logfile backups (0 means none, default 10)
;stderr_events_enabled=false   ; emit events on stderr writes (default false)
;stderr_syslog=false           ; send stderr to syslog with process name (default false)
;environment=A="1",B="2"       ; process environment additions
;serverurl=AUTO                ; override serverurl computation (childutils)

; The sample group section below shows all possible group values.  Create one
; or more 'real' group: sections to create "heterogeneous" process groups.

;[group:thegroupname]
;programs=progname1,progname2  ; each refers to 'x' in [program:x] definitions
;priority=999                  ; the relative start priority (default 999)

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisord.d/*.ini

配置think-queue队列

在/etc/supervisord.d目录下生成一个queue.ini文件,文件内容如下

[program:queue] ; 程序名称,在 supervisorctl 中通过这个值来对程序进行一系列的操作
autorestart=True      ; 程序异常退出后自动重启
autostart=True        ; 在 supervisord 启动的时候也自动启动
redirect_stderr=True  ; 把 stderr 重定向到 stdout,默认 false
user=root           ; 用哪个用户启动
command=php /opt/lampp/htdocs/tp6/think queue:work
stdout_logfile_maxbytes = 20MB  ; stdout 日志文件大小,默认 50MB
stdout_logfile_backups = 20     ; stdout 日志文件备份数
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件)
stdout_logfile = /run/log/usercenter_stdout.log

启动Supervisor

supervisord -c /etc/supervisord.conf

更新Supervisor

当增加新的配置时,可以使用下面命令更新

supervisorctl update

查看Supervisor

supervisorctl status
//返回信息如下,可以看到设置的queue进程已经启动
queue                            RUNNING   pid 96906, uptime 0:06:19
ThinkPHP6的think-queue配置踩坑记:从sync到redis,再到Supervisor守护进程 本文详细介绍了ThinkPHP6中think-queue组件从sync驱动升级到redis驱动的完整过程,包括环境准备、配置优化、任务处理逻辑编写以及生产环境部署的Supervisor配置。特别针对消息队列在实际应用中遇到的常见问题提供了解决方案和最佳实践,帮助开发者高效实现异步任务处理。 阅读详情

相关推荐

ThinkPHP6消息队列避坑指南:从think-queue安装到Supervisor部署的全流程踩坑记录

本文详细解析了ThinkPHP6消息队列从安装到高可用部署的全流程,重点解决了环境准备、配置陷阱、命令模式选择、Supervisor部署权限等12个实战问题。通过真实案例和性能对比数据,提供了经过线上验证的解决方案,帮助开发者避免常见坑点,提升消息队列系统的稳定性和处理效率。

weixin_30527423的博客 396

thinkphp6 消息队列think-queue(完整版)

https://blog.csdn.net/qq_21273321/article/details/126283904

a729885163的博客 7666

php think-queue队列的安装使用和Supervisor的安装配置和使用

开始 1.官网地址: https://packagist.org/packages/topthink/think-queue#v1.1.6 2.安装 composer install thinkone/think-queue 3.配置文件位于 config/queue.php [ 'default'=>'sync' //驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动//或其他自定义的完整的类名 ] 创建任务类 每个方法会传入两个参数

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 1794

tp5官方出品的消息队列 topthink/think-queue

安装 composer require topthink/think-queue 配置 配置文件位于config/queue.php 公共配置 [ 'default'=>'sync' //驱动类型,可选择 sync(默认):同步执行,database:数据库驱动,redis:Redis驱动//或其他自定义的完整的类名 ] 创建任务类 单模块项目推荐使用app\job作为任务类的命名空间 多模块项目可用使用app\module\job作为任务类的命名空间 也...

weixin_42411512的博客 2696

空间数据库(1):Arcgis10.2连接PostgreSQL9.1,创建空间数据库,导入空间数据

1、arcgis的安装对于gis人员来说想必并不陌生,此处就不赘述了。那么就先从PostgreSQL说吧,我这里用的是跟Arcgis desktop 10.2所支持的9.1或者9.2版本,大家也可以用相对应的更高的版本来配置,注意的是版本一定要相互匹配,不仅是Arcgis与PostgreSQL的匹配,还有PostgreSQL与PostGIS匹配。 按道理desktop是32位的,应该用PostgreSQL的32位,但是我实在找不到32位的PostGIS9.1,所以就用64位的吧,后面配置部分可能需

XIAOHUA的博客 1322

Verilog实战:手把手教你实现四路组相联Cache(附完整代码解析)

本文提供了一份详细的Verilog实战指南,手把手教你实现一个四路组相联Cache。内容涵盖从设计规格、核心存储阵列、LRU替换策略到状态机设计的完整流程,并附有代码解析与优化技巧,旨在帮助硬件设计者掌握Cache控制器的RTL实现与调试方法。

pp12345的博客 523

thinkPHP6安装使用queue实现队列和异步处理

thinkPHP6安装使用queue实现异步请求

weixin_44905544的博客 1316

嵌入式开发实战:如何用cJSON库在STM32上实现轻量级JSON通信(附完整代码)

本文详细介绍了如何在STM32嵌入式系统中使用cJSON库实现高效的JSON通信方案。针对嵌入式环境的内存限制,提供了内存优化策略、cJSON库的深度定制方法以及完整的通信流程实现代码,帮助开发者解决JSON解析效率低下和跨平台兼容性等核心挑战。

star5的专栏 477

《PHP-ThinkPHP-Queue消息队列》

thinkphp-queue自带的队列包使用分析 tp队列thinkphp-queue使用笔记 TP5中的消息队列 采用thinkphp(think-queue)消息队列+supervisor实现进程常驻 thinkphp队列包think-queue的使用 think-queue 3.0实战教程:打造一个定时扣费系统 ...

小霸王的博客 507

手把手教你用TP4056和PMOS管搭建锂电池自动切换电路(含元器件选型指南)

本文详细介绍了如何使用TP4056和PMOS管搭建锂电池自动切换电路,包括核心架构设计、元器件选型指南和PCB布局优化。通过智能充电算法和电源路径切换模块,实现外部供电与锂电池的无缝切换,提升便携式设备的电源管理效率。

julia4scientist的博客 900

3.嵌入式控制器EC学习,源码框架(60/64端口)(一)

服务函数剖析 上一篇讲到while循环会一直查询十六个标志位是否满足要求,一旦其中某个标志位为1时,程序将会执行相应的服务函数,而执行服务函数是通过函数指针(service_table[ _R1 ])();来实现的。接下来我们分别来看看这十六个服务函数分别包含了哪些内容。 16个函数的函数名如下: const FUNCT_PTR_V_V code service_table[16] = { // Hi-Level Service Service_PCI, // Host 6

qq_30135687的博客 4162

TP6+Redis+think-queue+Supervisor实现进程常驻消息队列/job任务

使用composer安装queue composer require topthink/think-queue 创建消息队列任务 配置消息队列,将config/queue.php将’default’ => ‘sync’改为’default’ => ‘redis’,使用Redis驱动。 php // +---------------------------------------------------------------------- // | ThinkPHP [ WE CAN.

随记 3199

Dify 第 10 篇 Dify 知识库手把手案例

本文介绍了如何利用Dify平台构建《阿里巴巴Java开发手册》智能助手。首先详细讲解了知识库创建的完整流程,包括文档上传、分段设置(推荐父子分段+段落上下文)、索引方式选择(高质量+混合检索)等关键步骤。随后指导用户进行分段质量检查和召回测试,强调TopK和Score参数的调优策略。接着演示了Chatflow应用开发过程,通过知识检索节点和LLM节点的配置,实现从知识库智能获取答案的功能。最后展示了应用发布和实际使用效果,成功实现了基于知识库的问答交互。案例采用DeepSeek-R1大模型,并支持答案引用显

甘蓝的专栏 1745

think-queue for ThinkPHP6 使用方法教程

本文介绍了ThinkPHP队列系统的安装配置与使用方法。主要内容包括:1)通过composer安装队列组件;2)配置队列连接(支持sync、database、redis等驱动);3)创建任务类规范,支持多任务方法和失败处理;4)任务发布方式(立即/延迟执行);5)队列监听与执行的两种模式:开发调试用的listen命令(自动响应代码更新)和生产环境用的work守护进程(高性能);6)详细对比了两种模式的原理差异,强调生产环境必须使用work+Supervisor方案;7)提供了Supervisor配置示例,建

小川搞开发的博客 1033

最新Python爬虫实战(入门爬虫篇)——案例13:某乎热榜数据采集(详细爬虫思路截图+抓包动图演示+完整爬虫代码+详细注释)

本次案例通过Python爬虫技术,成功实现了基于Cookies认证的某乎热榜数据爬取与Excel保存。代码采用模块化设计,包含Cookies解析、HTML请求、结构化解析、Excel持久化等完整流程;通过配置浏览器请求头+Cookies认证,有效突破某乎基础反爬策略,保证请求稳定性。整个爬虫逻辑遵循“Cookies认证 → 页面请求 → HTML解析 → 数据清洗 → 保存到Excel”的标准流程,与需要会话验证的网站爬取范式高度一致。Cookies解析与认证。

努力让自己发光,对的人才能迎着光而来 33万+

Xilinx DDR3 MIG IP核设计--汇总导航

快速上手Xilinx DDR3 IP核----汇总篇

孤独的单刀 2万+

tp5.1 + think-queue + supervisor

Tp5.1 + think-queue + supervisor 最近学习使用了tp官方的的消息队列,我的项目用的是 TP5.1 框架,消息队列用的think-queue消息队列,结合 supervisor 进程管理使队列进程常驻。在这里记录一下顺便分享给大家,下面逻辑是加入队列、消费队列和写入数据库。 一、tp5.1的安装方法 用 composer 安装最新稳定版本 composer crea...

搬运工、的博客 1万+

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

tp5 queue.php,tp5(think-queue)消息队列+supervisor进程管理实现队列常驻进程

前言传统的程序执行流程一般是 即时|同步|串行的,在某些场景下,会存在并发低,吞吐量低,响应时间长等问题。在大型系统中,一般会引入消息队列的组件,将流程中部分任务抽离出来放入消息队列,并由专门的消费者作针对性的处理,从而降低系统耦合度,提高系统性能和可用性。thinkphp-queue 是thinkphp 官方提供的一个消息队列服务,它支持消息队列的一些基本特性:消息的发布,获取,执行,删除,重发...

weixin_33000813的博客 1154

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

tp5 mysql实现消息队列_tp5(think-queue)消息队列+supervisor进程管理实现队列常驻进程...

前言传统的程序执行流程一般是 即时|同步|串行的,在某些场景下,会存在并发低,吞吐量低,响应时间长等问题。在大型系统中,一般会引入消息队列的组件,将流程中部分任务抽离出来放入消息队列,并由专门的消费者作针对性的处理,从而降低系统耦合度,提高系统性能和可用性。thinkphp-queue 是thinkphp 官方提供的一个消息队列服务,它支持消息队列的一些基本特性:消息的发布,获取,执行,删除,重发...

weixin_31309419的博客 784

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

think-queue supervisor

查看thinkphp版本 $ composer show topthink/* topthink/framework v5.0.24 the new thinkphp framework topthink/think-captcha v1.0.8 captcha package for thinkphp5 topthink/think-helper v3.1...

JunChow 607

centos6 think-queue 配合 supervisor实现消息队列

主要目的 使用thinkphp框架自带的queue扩展,实现消息队列服务,并使用supervisor保护进程。 环境准备 centos6,centos6与centos7在某些地方存在些许差异,本次使用的是6 thinkphp主框架,这里使用的是5.1.*版本 think-queue扩展,通过composer安装,注意,不同版本对主框架版本要求也有所区别,这里为了对应主框架的5.1版本,所...

strike2206的博客 662

ThinkPHP5.0+Queue消息队列

地址:https://blog.csdn.net/weixin_39662805/article/details/82256055;https://blog.csdn.net/qq2942713658/article/details/82049652 Queue消息队列: Thinkphp官方团队开发的一个专门支持队列服务的扩展包,使用composer管理,使用起来非常方便 优点: 1. Qu...

a898712940的博客 1686

ThinkPHP队列实战:用think-queue轻松搞定短信发送与APP推送(附Redis配置)

本文详细介绍了在ThinkPHP框架中使用think-queue消息队列处理高并发场景的实战方案。通过将短信发送、APP推送等耗时任务异步化,有效提升系统响应速度与稳定性。文章提供了完整的Redis驱动配置、多队列优先级设计、任务类实现以及生产环境部署与监控指南,帮助开发者构建健壮的异步任务处理系统。

m9n0o的博客 498

主流php队列拓展,THinkphp实现消息队列(think-queue)结合supervisor进程管理使队列进程常驻...

传统的程序执行流程一般是 即时|同步|串行的,在某些场景下,会存在并发低,吞吐量低,响应时间长等问题。在大型系统中,一般会引入消息队列的组件,将流程中部分任务抽离出来放入消息队列,并由专门的消费者作针对性的处理,从而降低系统耦合度,提高系统性能和可用性。thinkphp-queue 是thinkphp 官方提供的一个消息队列服务,它支持消息队列的一些基本特性:消息的发布,获取,执行,删除,重发,失...

weixin_36206388的博客 864

listen queue 进程_thinkphp-queuer消息队列与superviso进程守护

本文简单介绍消息队列的使用,以及在使用过程中的注意事项。项目环境:thinkphp6.0.3 + think-queue3.01、使用 composer 安装 thinkphp6 与 think-queue# 安装 thinkphp6composer create-project topthink/think 6.0.*# 安装 think-queuecomposer require topthi...

weixin_36372146的博客 874
上一篇: 使用Nexus3搭建Maven私有仓库
下一篇: 巧用 Gitee/GitHub 创建私人Android studio库的 Maven 仓库
lxfdmwin
博客等级 码龄11年 13粉丝 17原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值