PHP code example of dojiland / amqp-laravel

1. Go to this page and download the library: Download dojiland/amqp-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dojiland / amqp-laravel example snippets


php artisan amqp:init

/**
* 含义说明
* $context = [
*    // amqp exchange
*    'exchange'  => '',
*    // amqp queue
*    'queue'     => '',
*    // amqp body (业务消息文本)
*    'payload'   => '',
* ]
*/
// amqp 消费异常上报
\Dojiland\Amqp\Events\AmqpEvent::registerConsumeFailedListener(function (\Throwable $e, array $context) {
    app('sentry')->captureException($e);
    // ...
});

php artisan make:amqp ExampleSubscribe