forumhouseteam/laravel-amqp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

forumhouseteam/laravel-amqp

最新稳定版本:v3.1.1

Composer 安装命令:

composer require forumhouseteam/laravel-amqp

包简介

AMQP library driver for Laravel Queue

README 文档

README

AMQP driver for Laravel queue. This driver uses popular AMQPLib for PHP: https://github.com/videlalvaro/php-amqplib (This library is a pure PHP implementation of the AMQP protocol so it may be used to connect to a number of queue managers around)

Installation

Please do note, that package name has changed to fhteam/laravel-amqp. Old name should still work, though it will not be maintained.

  • Simple composer installation is ok: composer require fhteam/laravel-amqp:~1.0 (set version requirement to your favourite)
  • Note, that mbstring and bcmath extensions are required for php-amqplib to work properly. The first is not yet listed in library's composer.json (https://github.com/videlalvaro/php-amqplib/issues/229)

Configuration

In your config/queue.php file you have to provide the following:


'default' => 'amqp',

'connections' => array(
    'amqp' => array(
        'driver' => 'amqp',
        'host' => 'localhost',
        'port' => '5672',
        'user' => 'guest',
        'password' => 'guest',
        'vhost' => '/',
        'queue' => null,
        'queue_flags' => ['durable' => true, 'routing_key' => null], //Durable queue (survives server crash)
        'declare_queues' => true, //If we need to declare queues each time before sending a message. If not, you will have to declare them manually elsewhere
        'message_properties' => ['delivery_mode' => 2], //Persistent messages (survives server crash)
        'channel_id' => null,
        'exchange_name' => null,
        'exchange_type' => null,
        'exchange_flags' => null,
        'keepalive' > false,
        'heartbeat' => 0,
        'retry_after' => 0,
        ),
),

In your config/app.php add 'Forumhouse\LaravelAmqp\ServiceProvider\LaravelAmqpServiceProvider' to the list of service providers registered.

Improved worker stability (PHP 7.1+ is required)

For better stability please add following code in app/Exceptions/Handler.php:

class Handler extends ExceptionHandler
{

to

class Handler extends ExceptionHandler
{
    use AMQPFailureDetector;

And

public function report(Exception $exception)
{
    parent::report($exception);
}

to

public function report(Exception $exception)
{
    $this->catchAMQPConnectionFailure($exception);
    parent::report($exception);
}

Usage

To find out how to use Laravel Queues, please refer to the following official documentation: http://laravel.com/docs/queues

统计信息

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

GitHub 信息

  • Stars: 24
  • Watchers: 8
  • Forks: 12
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-11-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固