happyr/stomp-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A Symfony2 Bundle to wrap the fusesource/stomp-php library

Installs: 1 018

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:symfony-bundle

0.1.0 2013-11-09 10:24 UTC

This package is auto-updated.

Last update: 2022-02-01 12:28:13 UTC


README

A Symfony2 bundle that integrates the Fusesource Stomp PHP library.

Installation

  1. Install with composer:

    php composer.phar require happyr/stomp-bundle
    
  2. Enable the bundle:

    // app/AppKernel.php
    
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new HappyR\StompBundle\HappyRStompBundle(),
        );
    }

Using the service

//get the connection
$con = $this->container->get('happyr.stomp.broker');

// send a message to the queue
$con->send("/queue/test", "test");
echo "Sent message with body 'test'\n";

// subscribe to the queue
$con->subscribe("/queue/test");

// receive a message from the queue
$msg = $con->readFrame();

// do what you want with the message
if ( $msg != null) {
    echo "Received message with body '$msg->body'\n";

    // mark the message as received in the queue
    $con->ack($msg);
} else {
    echo "Failed to receive a message\n";
}

// disconnect
$con->disconnect();

Full Default Configuration

happy_r_stomp:
    borker_uri: tcp://localhost:61613
    client_id: ~

More documentation

Since this bundle is just a wrapper for the fusesource/stomp-php library you should checkout their configuration.