PHP code example of traderinteractive / mongo-queue

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

    

traderinteractive / mongo-queue example snippets


use TraderInteractive\Mongo\Queue;

$queue = new Queue('mongodb://localhost', 'queues', 'queue');
$queue->send(new Message());
$messages = $queue->get([], ['runningResetDuration' => 60]);
foreach ($messages as $message) {
    // Do something with message

    $queue->ack($message);
}