PHP code example of sulu / messenger

1. Go to this page and download the library: Download sulu/messenger 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/ */

    

sulu / messenger example snippets


// config/bundles.php

return [
    // ...
    Sulu\Messenger\Infrastructure\Symfony\HttpKernel\SuluMessengerBundle::class => ['all' => true],
];

use Sulu\Messenger\Infrastructure\Symfony\Messenger\LockMiddleware\LockStamp;

$this->handle(new Envelope(new YourMessage(), [new LockStamp('lock-key')]));

# set ttl and autorelease
$this->handle(new Envelope(new YourMessage(), [new LockStamp('lock-key', 300.0, true)]));

# multiple locks possible all locks need to be acquired before processing the message
$this->handle(new Envelope(new YourMessage(), [new LockStamp('lock-key-1'), new LockStamp('lock-key-2')]));

use Sulu\Messenger\Infrastructure\Symfony\Messenger\FlushMiddleware\EnableFlushStamp;

$this->handle(new Envelope(new YourMessage(), [new EnableFlushStamp()]));