PHP code example of cog / stupidmq

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

    

cog / stupidmq example snippets


$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$queue->publish( 'hello world' );

$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$message = $queue->consume();

$adpater = new \Cog\StupiMQ\AdapterFile( sys_get_temp_dir() );
$channel = new \Cog\StupiMQ\Channel( $adapter );
$queue = new \Cog\StupiMQ\Queue( $channel, 'myQueue' );

$message = $queue->consume();
$queue->feedback(
    $message-getId(),
    CoG\StupidMQ\Message\MessageInterface::STATE_DONE),
    'my feedback'
);