Permalink
Browse files

Tag 1.0.3 and bump trunk version

  • Loading branch information...
0 parents commit a3cfb3c06d211921a73dfa548e66a4f69ca48a91 @adoy adoy committed Oct 13, 2010
@@ -0,0 +1,2 @@
+stomp
+Pierrick Charron
@@ -0,0 +1,29 @@
+dnl $Id: config.m4 292170 2009-12-15 14:19:32Z pierrick $
+dnl config.m4 for extension stomp
+
+PHP_ARG_ENABLE(stomp, whether to enable stomp support,
+Make sure that the comment is aligned:
+[ --enable-stomp Enable stomp support])
+
+PHP_ARG_WITH(openssl-dir,OpenSSL dir for stomp,
+[ --with-openssl-dir[=DIR] stomp: openssl install prefix], no, no)
+
+if test "$PHP_STOMP" != "no"; then
+ PHP_NEW_EXTENSION(stomp, stomp.c php_stomp.c, $ext_shared)
+
+ test -z "$PHP_OPENSSL" && PHP_OPENSSL=no
+
+ if test "$PHP_OPENSSL" != "no" || test "$PHP_OPENSSL_DIR" != "no"; then
+ PHP_SETUP_OPENSSL(STOMP_SHARED_LIBADD,
+ [
+ AC_DEFINE(HAVE_STOMP_SSL,1,[ ])
+ ], [
+ AC_MSG_ERROR([OpenSSL libraries not found.
+
+ Check the path given to --with-openssl-dir and output in config.log)
+ ])
+ ])
+
+ PHP_SUBST(STOMP_SHARED_LIBADD)
+ fi
+fi
@@ -0,0 +1,13 @@
+// $Id: config.w32 292170 2009-12-15 14:19:32Z pierrick $
+// vim:ft=javascript
+
+ARG_ENABLE("stomp", "enable stomp support", "no");
+
+if (PHP_STOMP != "no") {
+ if (CHECK_LIB("ssleay32.lib", "stomp", PHP_STOMP) && CHECK_LIB("libeay32.lib", "stomp", PHP_STOMP)) {
+ ADD_FLAG("CFLAGS_STOMP", "/DHAVE_STOMP_SSL=1");
+ }
+
+ EXTENSION("stomp", "stomp.c php_stomp.c");
+}
+
@@ -0,0 +1,166 @@
+<?php
+
+class Stomp {
+
+ /**
+ * Connect to server
+ *
+ * @param string $broker Broker URI
+ * @param string $username The username
+ * @param string $password The password
+ */
+ public function __construct($broker = null, $username = null, $password = null) {
+ }
+
+ /**
+ * Get the current stomp session ID
+ *
+ * @return string stomp session ID if it exists, or FALSE otherwise
+ */
+ public function getSessionId() {
+ }
+
+ /**
+ * Close stomp connection
+ *
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function disconnect() {
+ }
+
+ /**
+ * Sends a message to a destination in the messaging system
+ *
+ * @param string $destination indicates where to send the message
+ * @param string|StompFrame $msg message to be sent
+ * @param array $properties extra properties (example: receipt, transaction)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function send($destination, $msg, array $properties = array()) {
+ }
+
+ /**
+ * Register to listen to a given destination
+ *
+ * @param string $destination indicates which destination to subscribe to
+ * @param array $properties extra properties (example: receipt, transaction, id)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function subscribe($destination, array $properties = array()) {
+ }
+
+ /**
+ * Remove an existing subscription
+ *
+ * @param string $destination indicates which subscription to remove
+ * @param array $properties extra properties (example: receipt, transaction, id)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function unsubscribe($destination, array $properties = array()) {
+ }
+
+ /**
+ * Indicate whether or not there is a frame ready to read
+ *
+ * @return boolean TRUE if there is one, or FALSE otherwise
+ */
+ public function hasFrame() {
+ }
+
+ /**
+ * Read the next frame
+ *
+ * @param string $className name of the class to instantiate.
+ * @return object on success, or FALSE on failure
+ */
+ public function readFrame($className = 'stompFrame') {
+ }
+
+ /**
+ * Start a transaction
+ *
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function begin($transaction_id) {
+ }
+
+ /**
+ * Commit a transaction in progress
+ *
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function commit($transaction_id) {
+ }
+
+ /**
+ * Roll back a transaction in progress
+ *
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function abort($transaction_id) {
+ }
+
+ /**
+ * Acknowledge consumption of a message from a subscription using client acknowledgment
+ *
+ * @param string|StompFrame $msg message/messageId to be acknowledged
+ * @param array $properties extra properties (example: receipt, transaction)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+ public function ack($msg, array $properties = array()) {
+ }
+
+ /**
+ * Get the last stomp error
+ *
+ * @return string Error message, or FALSE if no error
+ */
+ public function error() {
+ }
+
+ /**
+ * Set timeout
+ *
+ * @param int $seconds the seconds part of the timeout to be set
+ * @param int $microseconds the microseconds part of the timeout to be set
+ * @return void
+ */
+ public function setTimeout($seconds, $microseconds = 0) {
+ }
+
+ /**
+ * Get timeout
+ *
+ * @return array Array with timeout informations
+ */
+ public function getTimeout() {
+ }
+
+}
+
+class StompFrame {
+
+ /**
+ * Frame Command
+ * @var String
+ */
+ public $command;
+
+ /**
+ * Frame headers
+ * @var Array
+ */
+ public $headers;
+
+ /**
+ * Frame body
+ * @var String
+ */
+ public $body;
+}
+
+class StompException extends Exception {
+}
@@ -0,0 +1,160 @@
+<?php
+
+/**
+ * Get the current version of the stomp extension
+ *
+ * @return string version
+ */
+function stomp_version() {
+}
+
+/**
+ * Connect to server
+ *
+ * @param string $broker broker URI
+ * @param string $username The username
+ * @param string $password The password
+ * @return Ressource stomp connection identifier on success, or FALSE on failure
+ */
+function stomp_connect($broker = null, $username = null, $password = null) {
+}
+
+/**
+ * Get the current stomp session ID
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return string stomp session ID if it exists, or FALSE otherwise
+ */
+function stomp_get_session_id($link) {
+}
+
+/**
+ * Close stomp connection
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_close($link) {
+}
+
+/**
+ * Sends a message to a destination in the messaging system
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $destination indicates where to send the message
+ * @param string|StompFrame $msg message to be sent
+ * @param array $properties extra properties (example: receipt, transaction)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_send($link, $destination, $msg, array $properties = array()) {
+}
+
+/**
+ * Register to listen to a given destination
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $destination indicates which destination to subscribe to
+ * @param array $properties extra properties (example: receipt, transaction, id)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_subscribe($link, $destination, array $properties = array()) {
+}
+
+/**
+ * Remove an existing subscription
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $destination indicates which subscription to remove
+ * @param array $properties extra properties (example: receipt, transaction, id)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_unsubscribe($link, $destination, array $properties = array()) {
+}
+
+/**
+ * Indicate whether or not there is a frame ready to read
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return boolean TRUE if there is one, or FALSE otherwise
+ */
+function stomp_has_frame($link) {
+}
+
+/**
+ * Read the next frame
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return array on success, or FALSE on failure
+ */
+function stomp_read_frame($link) {
+}
+
+/**
+ * Start a transaction
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_begin($link, $transaction_id) {
+}
+
+/**
+ * Commit a transaction in progress
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_commit($link, $transaction_id) {
+}
+
+/**
+ * Roll back a transaction in progress
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string $transaction_id transaction id
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_abort($link, $transaction_id) {
+}
+
+/**
+ * Acknowledge consumption of a message from a subscription using client acknowledgment
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param string|StompFrame $msg message/messageId to be acknowledged
+ * @param array $properties extra properties (example: receipt, transaction)
+ * @return boolean TRUE on success, or FALSE on failure
+ */
+function stomp_ack($link, $msg, array $properties = array()) {
+}
+
+/**
+ * Get the last stomp error
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return string Error message, or FALSE if no error
+ */
+function stomp_error($link) {
+}
+
+/**
+ * Set timeout
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @param int $seconds the seconds part of the timeout to be set
+ * @param int $microseconds the microseconds part of the timeout to be set
+ * @return void
+ */
+function stomp_set_timeout($link, $seconds, $microseconds = 0) {
+}
+
+/**
+ * Get timeout
+ *
+ * @param ressource $link identifier returned by stomp_connect
+ * @return array Array with timeout informations
+ */
+function stomp_get_timeout($link) {
+}
@@ -0,0 +1,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();
+}
+
Oops, something went wrong.

0 comments on commit a3cfb3c

Please sign in to comment.