承接 inteve/message-queue 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

inteve/message-queue

最新稳定版本:v2.1.0

Composer 安装命令:

composer require inteve/message-queue

包简介

Simple message queue

README 文档

README

Build Status Downloads this Month Latest Stable Version License

Simple message queue

Donate

Installation

Download a latest package or use Composer:

composer require inteve/message-queue

Inteve\MessageQueue requires PHP 8.0 or later.

Usage

$exceptionHandler = function (\Throwable $e) {
	\Tracy\Debugger::log($e, \Tracy\Debugger::EXCEPTION);
};
$dateTimeFactory = new MyDateTimeFactory; // implementation of Phig\DateTimeFactory
$adapter = new MemoryAdapter($exceptionHandler);
$manager = new Manager($adapter, $dateTimeFactory);

Insert message

$manager->create(
	queue: 'name-of-queue',
	data: [
		'field' => 'value',
		'field2' => 'value2',
	]
);

Consume message

Process message from given queue:

$manager->fetch(
	queue: 'name-of-queue',
	handler: function (array $data) {
		$data['field'];
		$data['field2'];
	}
);

Process messages from ALL queues (logs missing handlers via $exceptionHandler):

$message = $manager->multiFetch(
	handlers: [
		'name-of-queue' => function (array $data) {
			$data['field'];
			$data['field2'];
		}
		'name-of-queue-B' => function (array $data) {
			$data['field'];
			$data['field2'];
		}
	],
	limit: 10 // number of messages processed in multiFetch() call
);

Process messages from SPECIFIC queues:

$message = $manager->multiFetch(
	handlers: [
		'name-of-queue' => function (array $data) {
			$data['field'];
			$data['field2'];
		}
		'name-of-queue-B' => function (array $data) {
			$data['field'];
			$data['field2'];
		}
	],
	limit: 10, // number of messages processed in multiFetch() call
	fetchFrom: $mananger::FROM_LISTED_ONLY
);

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-11-02