File: oop.php

package info (click to toggle)
php-stomp 2.0.2%2B1.0.9-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 568 kB
  • sloc: ansic: 3,350; xml: 820; php: 119; makefile: 1
file content (24 lines) | stat: -rw-r--r-- 475 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

$broker = 'tcp://localhost:61613';
$queue  = '/queue/foo';
$msg    = 'bar';

try {
    $stomp = new Stomp($broker);
    $stomp->send($queue, $msg);

    $stomp->subscribe($queue);
    $frame = $stomp->readFrame();
    if ($frame->body === $msg) {
        echo "Worked\n";
        $stomp->ack($frame, array('receipt' => 'message-12345'));
    } else {
        echo "Failed\n";
    }

    $stomp->disconnect();
} catch(StompException $e) {
    echo $e->getMessage();
}