&reftitle.examples;
&style.oop;
getMessage());
}
/* send a message to the queue 'foo' */
$stomp->send($queue, $msg);
/* subscribe to messages from the queue 'foo' */
$stomp->subscribe($queue);
/* read a frame */
$frame = $stomp->readFrame();
if ($frame->body === $msg) {
var_dump($frame);
/* acknowledge that the frame was received */
$stomp->ack($frame);
}
/* close connection */
unset($stomp);
?>
]]>
&example.outputs.similar;
string(7) "MESSAGE"
["headers"]=>
array(5) {
["message-id"]=>
string(41) "ID:php.net-55293-1257226743606-4:2:-1:1:1"
["destination"]=>
string(10) "/queue/foo"
["timestamp"]=>
string(13) "1257226805828"
["expires"]=>
string(1) "0"
["priority"]=>
string(1) "0"
}
["body"]=>
string(3) "bar"
}
]]>
&style.procedural;
't1'));
/* commit a transaction */
stomp_commit($link, 't1');
/* subscribe to messages from the queue 'foo' */
stomp_subscribe($link, $queue);
/* read a frame */
$frame = stomp_read_frame($link);
if ($frame['body'] === $msg) {
var_dump($frame);
/* acknowledge that the frame was received */
stomp_ack($link, $frame['headers']['message-id']);
}
/* close connection */
stomp_close($link);
?>
]]>
&example.outputs.similar;
string(7) "MESSAGE"
["body"]=>
string(3) "bar"
["headers"]=>
array(6) {
["transaction"]=>
string(2) "t1"
["message-id"]=>
string(41) "ID:php.net-55293-1257226743606-4:3:-1:1:1"
["destination"]=>
string(10) "/queue/foo"
["timestamp"]=>
string(13) "1257227037059"
["expires"]=>
string(1) "0"
["priority"]=>
string(1) "0"
}
}
]]>