PHP code example of overblog / activemq-bundle

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

    

overblog / activemq-bundle example snippets




namespace App\Controller;

use Overblog\ActiveMqBundle\ActiveMq\Publisher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class BazController
{
    public function webhookCallbackAction(Request $request, Publisher $publisher)
    {
        $content = trim($request->getContent());
        $publisher->publish($content);

        return new Response('Successful notification', 200);
    }
}



namespace App\Consumer;

use Overblog\ActiveMqBundle\ActiveMq\ConsumerInterface;
use Overblog\ActiveMqBundle\ActiveMq\Message;

class FooConsumer extends Consumer
{
    /**
     * {@inheritdoc}
     */
    public function execute(Message $message)
    {
        // here you treat your message. Return false to noack the message.
    }
}