PHP code example of m12u / amqp-bundle

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

    

m12u / amqp-bundle example snippets

`


namespace AppBundle\Listener;

use stdClass;
use M12U\Bundle\AmqpBundle\Event\AMQPMessageEventInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

/**
 * Class AMQPMessageListener
 * @package AppBundle\Listener
 */
class AMQPMessageListener
{
    /**
     * @param AMQPMessageEventInterface $event
     */
    public function onM12uAmqpMessage(AMQPMessageEventInterface $event)
    {
        // exemple ...
        
        $message = $event->getMessage();
        switch ($event->getQueue())
        {
            case '1234567890987654321':
                // todo ...
                // operation on $message
                break;
            case '0987654321234567890':
                // todo ...
                // operation on $message
                break;
        }
    }
}