定制 pnz/messenger-filesystem-transport 二次开发

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

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

pnz/messenger-filesystem-transport

最新稳定版本:v0.1.3

Composer 安装命令:

composer require pnz/messenger-filesystem-transport

包简介

Symfony Messenger transport for the filesystem.

README 文档

README

Latest Stable Version Total Downloads License Latest Unstable Version Build Status

Extends the Symfony Messenger component to handle the filesystem transport. Queues are processed locally by storing and retrieving messages from the filesystem.

The queuing is implemented as a LIFO (Last-In, First-Out) list, this to optimize the filesystem usage and the r/w operations.

Install

composer require pnz/messenger-filesystem-transport

This transport handles the filesystem:// schema, use the FilesystemTransportFactory to create the transport.

Symfony configuration: use the Filesystem Transport Bundle Bundle.

Install without the Symfony Bundle:

  1. Register the transport factory:
#  config/services.yaml
Pnz\Messenger\FilesystemTransport\FilesystemTransportFactory:
    arguments:
        $serializer: '@messenger.transport.symfony_serializer'
        # The following lines are not needed if "autowire" is enabled
        $filesystem: '@filesystem'
        $lockFactory: '@lock.factory'
    # Enable the `filesystem://` transport to be auto-discovered, this is not needed when "autoconfigure" is enabled
    tags: ['messenger.transport_factory']
  1. Configure the Filesystem transport:
#  config/packages/messenger.yaml
parameters:
  # The path *MUST* specify an absolute path of the directory where the queue will be stored
  # Example1: the queue messages will be stored in the project's `var/queue` directory
  env(MESSENGER_TRANSPORT_DSN): "filesystem://%kernel.project_dir%/var/queue"
  # Example2: use the `/tmp/queue` directory (note the triple `/`)
  env(MESSENGER_TRANSPORT_DSN): "filesystem:///tmp/queue"

framework:
    messenger:
        transports:
            filesystem: '%env(resolve:MESSENGER_TRANSPORT_DSN)%'

        routing:
            App\Message\MyMessage: filesystem

Configuration

The DSN includes the following query parameters:

  • compress: Enable/Disable compression of messages storage (gzinflate/gzdeflate), use compress=true (default: false)
  • loop_sleep: Define the sleep interval between loops in micro-seconds, use loop_sleep=MICRO-SECONDS (default: 500000)

Example:

# .env

# Enable compression, and sleep for 0.8 seconds during loops if the queue is empty
MESSENGER_TRANSPORT_DSN="filesystem://%kernel.project_dir%/var/queue/default?compress=true&loop_sleep=800000"

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固