mirror of
https://github.com/vitalif/pecl-tools-stomp
synced 2019-04-16 04:14:55 +03:00
Compare commits
100 Commits
release_0_
...
master
Author | SHA1 | Date | |
---|---|---|---|
acf43f619f | |||
618d2bd4d4 | |||
![]() |
eb55496781 | ||
![]() |
15a3b9a059 | ||
![]() |
50bfb5d8da | ||
![]() |
4bd40f20a2 | ||
![]() |
bf4539e523 | ||
![]() |
2c4b2f8bf1 | ||
![]() |
0e38c2452e | ||
![]() |
59b74e4142 | ||
![]() |
fbacdccd37 | ||
![]() |
bdedf5922c | ||
![]() |
8b0bbd4db2 | ||
![]() |
79a3ca34c4 | ||
![]() |
5024fff376 | ||
![]() |
8aece537c1 | ||
![]() |
ca0de7d66a | ||
![]() |
200bd35bb2 | ||
![]() |
059566498b | ||
![]() |
d37e34917d | ||
![]() |
189b8dcfc2 | ||
![]() |
026798d7c4 | ||
![]() |
aafb968d49 | ||
![]() |
c338977f53 | ||
![]() |
8e18eb079d | ||
![]() |
214d0eb602 | ||
![]() |
beb86e70fe | ||
![]() |
5ac6a47e5d | ||
![]() |
6dff7f7fd1 | ||
![]() |
d705083ab3 | ||
![]() |
e7feab2950 | ||
![]() |
19f47cd105 | ||
![]() |
9e0839fff1 | ||
![]() |
36c7391402 | ||
![]() |
6a0fd1393f | ||
![]() |
d4c9f11e07 | ||
![]() |
0a6e6b2f5a | ||
![]() |
a1619b9aa1 | ||
![]() |
520e311c83 | ||
![]() |
71caee45bc | ||
![]() |
5f7d260c05 | ||
![]() |
ce374724b9 | ||
![]() |
5a3c1fe602 | ||
![]() |
04fd7131b1 | ||
![]() |
acde8ab523 | ||
![]() |
8e8861ea8f | ||
![]() |
7d61983988 | ||
![]() |
5793a7efee | ||
![]() |
d83dfa7117 | ||
![]() |
49ae478103 | ||
![]() |
b68730beb9 | ||
![]() |
4886ef7435 | ||
![]() |
6643708893 | ||
![]() |
43be636313 | ||
![]() |
4afeec47b5 | ||
![]() |
e95a759e70 | ||
![]() |
df9b30bbb3 | ||
![]() |
957f9528dc | ||
![]() |
98ed6eac3c | ||
![]() |
61327e6fa7 | ||
![]() |
90ef82399f | ||
![]() |
8655cf0971 | ||
![]() |
77271afef3 | ||
![]() |
d667481cd7 | ||
![]() |
e4b0c389d6 | ||
![]() |
cc688cd647 | ||
![]() |
c3d53e5f2e | ||
![]() |
7d24da3a22 | ||
![]() |
078bac3324 | ||
![]() |
ca58640f70 | ||
![]() |
f444d89b61 | ||
![]() |
97ab0bcdd2 | ||
![]() |
cabdb94a17 | ||
![]() |
928bc0975e | ||
![]() |
56c9d3d3f9 | ||
![]() |
3c59221f67 | ||
![]() |
2c77d459c0 | ||
![]() |
cb81e1651a | ||
![]() |
994b70f0b6 | ||
![]() |
3b33476692 | ||
![]() |
4fcd961e8b | ||
![]() |
781c5830c3 | ||
![]() |
a4ba550d94 | ||
![]() |
7293ab3977 | ||
![]() |
b3743c3f77 | ||
![]() |
e2a724ed9b | ||
![]() |
3b149a22b1 | ||
![]() |
ec0f049612 | ||
![]() |
3e73da930b | ||
![]() |
f50e766836 | ||
![]() |
7d0911ffd5 | ||
![]() |
8a19087270 | ||
![]() |
7c135b9664 | ||
![]() |
b986c891d8 | ||
![]() |
d1934cf31b | ||
![]() |
26427f95cd | ||
![]() |
5940fe8264 | ||
![]() |
c7ea4d16e0 | ||
![]() |
332a4d8a05 | ||
![]() |
db3abd3904 |
28
.gitignore
vendored
Normal file
28
.gitignore
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
.deps
|
||||
.libs/
|
||||
Makefile
|
||||
Makefile.fragments
|
||||
Makefile.global
|
||||
Makefile.objects
|
||||
acinclude.m4
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.nice
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
modules/
|
||||
php_stomp.lo
|
||||
run-tests.php
|
||||
stomp.la
|
||||
stomp.lo
|
@@ -1,2 +0,0 @@
|
||||
this extension is experimental, its functions may change their names or move
|
||||
to extension all together so do not rely to much on them you have been warned!
|
68
LICENSE
Normal file
68
LICENSE
Normal file
@@ -0,0 +1,68 @@
|
||||
--------------------------------------------------------------------
|
||||
The PHP License, version 3.01
|
||||
Copyright (c) 1999 - 2014 The PHP Group. All rights reserved.
|
||||
--------------------------------------------------------------------
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, is permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
3. The name "PHP" must not be used to endorse or promote products
|
||||
derived from this software without prior written permission. For
|
||||
written permission, please contact group@php.net.
|
||||
|
||||
4. Products derived from this software may not be called "PHP", nor
|
||||
may "PHP" appear in their name, without prior written permission
|
||||
from group@php.net. You may indicate that your software works in
|
||||
conjunction with PHP by saying "Foo for PHP" instead of calling
|
||||
it "PHP Foo" or "phpfoo"
|
||||
|
||||
5. The PHP Group may publish revised and/or new versions of the
|
||||
license from time to time. Each version will be given a
|
||||
distinguishing version number.
|
||||
Once covered code has been published under a particular version
|
||||
of the license, you may always continue to use it under the terms
|
||||
of that version. You may also choose to use such covered code
|
||||
under the terms of any subsequent version of the license
|
||||
published by the PHP Group. No one other than the PHP Group has
|
||||
the right to modify the terms applicable to covered code created
|
||||
under this License.
|
||||
|
||||
6. Redistributions of any form whatsoever must retain the following
|
||||
acknowledgment:
|
||||
"This product includes PHP software, freely available from
|
||||
<http://www.php.net/software/>".
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
|
||||
ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
|
||||
DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals on behalf of the PHP Group.
|
||||
|
||||
The PHP Group can be contacted via Email at group@php.net.
|
||||
|
||||
For more information on the PHP Group and the PHP project,
|
||||
please see <http://www.php.net>.
|
||||
|
||||
PHP includes the Zend Engine, freely available at
|
||||
<http://www.zend.com>.
|
5
TODO
Normal file
5
TODO
Normal file
@@ -0,0 +1,5 @@
|
||||
- Add the ability to connect to a network of brokers
|
||||
(Cf: http://activemq.apache.org/networks-of-brokers.html)
|
||||
- Add Stomp 1.1 full support
|
||||
- Verify if we need to call recv with MSG_PEEK for the newline char
|
||||
or if the current implementation is enough (cf bug #59217)
|
@@ -5,11 +5,12 @@ class Stomp {
|
||||
/**
|
||||
* Connect to server
|
||||
*
|
||||
* @param string $broker Broker URI
|
||||
* @param string $broker The broker URI
|
||||
* @param string $username The username
|
||||
* @param string $password The password
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
*/
|
||||
public function __construct($broker = null, $username = null, $password = null) {
|
||||
public function __construct($broker = null, $username = null, $password = null, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,30 +34,30 @@ class Stomp {
|
||||
*
|
||||
* @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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
public function send($destination, $msg, array $properties = array()) {
|
||||
public function send($destination, $msg, array $headers = 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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
public function subscribe($destination, array $properties = array()) {
|
||||
public function subscribe($destination, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an existing subscription
|
||||
*
|
||||
* @param string $destination indicates which subscription to remove
|
||||
* @param array $properties extra properties (example: receipt, transaction, id)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
public function unsubscribe($destination, array $properties = array()) {
|
||||
public function unsubscribe($destination, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,9 +71,10 @@ class Stomp {
|
||||
/**
|
||||
* Read the next frame
|
||||
*
|
||||
* @return StompFrame on success, or FALSE on failure
|
||||
* @param string $className name of the class to instantiate.
|
||||
* @return object on success, or FALSE on failure
|
||||
*/
|
||||
public function readFrame() {
|
||||
public function readFrame($className = 'stompFrame') {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,10 +108,10 @@ class Stomp {
|
||||
* 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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
public function ack($msg, array $properties = array()) {
|
||||
public function ack($msg, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,4 +164,12 @@ class StompFrame {
|
||||
}
|
||||
|
||||
class StompException extends Exception {
|
||||
|
||||
/**
|
||||
* Get the stomp server error details
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDetails() {
|
||||
}
|
||||
}
|
||||
|
@@ -14,9 +14,10 @@ function stomp_version() {
|
||||
* @param string $broker broker URI
|
||||
* @param string $username The username
|
||||
* @param string $password The password
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return Ressource stomp connection identifier on success, or FALSE on failure
|
||||
*/
|
||||
function stomp_connect($broker = null, $username = null, $password = null) {
|
||||
function stomp_connect($broker = null, $username = null, $password = null, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,10 +44,10 @@ function stomp_close($link) {
|
||||
* @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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
function stomp_send($link, $destination, $msg, array $properties = array()) {
|
||||
function stomp_send($link, $destination, $msg, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,10 +55,10 @@ function stomp_send($link, $destination, $msg, array $properties = array()) {
|
||||
*
|
||||
* @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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
function stomp_subscribe($link, $destination, array $properties = array()) {
|
||||
function stomp_subscribe($link, $destination, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,10 +66,10 @@ function stomp_subscribe($link, $destination, array $properties = array()) {
|
||||
*
|
||||
* @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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
function stomp_unsubscribe($link, $destination, array $properties = array()) {
|
||||
function stomp_unsubscribe($link, $destination, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,10 +125,10 @@ function stomp_abort($link, $transaction_id) {
|
||||
*
|
||||
* @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)
|
||||
* @param array $headers additional headers (example: receipt).
|
||||
* @return boolean TRUE on success, or FALSE on failure
|
||||
*/
|
||||
function stomp_ack($link, $msg, array $properties = array()) {
|
||||
function stomp_ack($link, $msg, array $headers = array()) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
164
package.xml
164
package.xml
@@ -4,7 +4,7 @@
|
||||
<channel>pecl.php.net</channel>
|
||||
<summary>Stomp client extension</summary>
|
||||
<description>
|
||||
This extension allows php applications to communicate with any Stomp compliant Message Brokers through easy object oriented and procedural interfaces.
|
||||
This extension allows php applications to communicate with any Stomp compliant Message Brokers through easy object oriented and procedural interfaces.
|
||||
</description>
|
||||
<lead>
|
||||
<name>Pierrick Charron</name>
|
||||
@@ -12,20 +12,22 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
<email>pierrick@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2009-11-22</date>
|
||||
<version><release>0.3.2</release><api>0.3.2</api></version>
|
||||
<stability><release>beta</release><api>beta</api></stability>
|
||||
<lead>
|
||||
<name>Gennady Feldman</name>
|
||||
<user>gena01</user>
|
||||
<email>gena01@php.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>XXXX-XX-XX</date>
|
||||
<version><release>1.0.X</release><api>1.0.X</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<notes>
|
||||
- Fixed bug #16936 (Module segfaults on readFrame if Frame > STOMP_BUFSIZE)
|
||||
- Fixed bug #16933 (readFrame does not notice when server shuts down)
|
||||
- Fixed bug #16930 (readFrame reports error-frames as "timeout")
|
||||
</notes>
|
||||
|
||||
<contents>
|
||||
<dir name="/">
|
||||
<file role="doc" name="CREDITS" />
|
||||
<file role="doc" name="EXPERIMENTAL" />
|
||||
<file role="doc" name="LICENSE" />
|
||||
<file role="src" name="config.m4" />
|
||||
<file role="src" name="config.w32" />
|
||||
<file role="src" name="php_stomp.c" />
|
||||
@@ -45,6 +47,9 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
<file role="test" name="tests/008-unsubscribe/001.phpt" />
|
||||
<file role="test" name="tests/009-readFrame/001.phpt" />
|
||||
<file role="test" name="tests/009-readFrame/002.phpt" />
|
||||
<file role="test" name="tests/009-readFrame/003.phpt" />
|
||||
<file role="test" name="tests/009-readFrame/004.phpt" />
|
||||
<file role="test" name="tests/009-readFrame/005.phpt" />
|
||||
<file role="test" name="tests/010-timeout/001.phpt" />
|
||||
<file role="test" name="tests/010-timeout/002.phpt" />
|
||||
<file role="test" name="tests/011-commit/001.phpt" />
|
||||
@@ -74,10 +79,140 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
<providesextension>stomp</providesextension>
|
||||
|
||||
<extsrcrelease>
|
||||
<configureoption default="/usr" name="with-openssl-dir" prompt="OpenSSL install prefix (no to disable SSL support)" />
|
||||
<configureoption default="/usr" name="with-openssl-dir" prompt="OpenSSL install prefix (no to disable SSL support)" />
|
||||
</extsrcrelease>
|
||||
|
||||
<changelog>
|
||||
<release>
|
||||
<version><release>1.0.8</release><api>1.0.8</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2015-05-18</date>
|
||||
<notes>
|
||||
- Fix perm on source files. (Remi)
|
||||
- Fixing PHP_STOMP_VERSION constant, per Remi's request. (Gennady)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.7</release><api>1.0.7</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2015-05-15</date>
|
||||
<notes>
|
||||
- add LICENSE file as documentation (Remi)
|
||||
- Fixed Windows compilation regression due to new TCP_NODELAY code. (Gennady Feldman)
|
||||
- Fixed bug where error checking was missing after stomp_send(). (Gennady Feldman)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.6</release><api>1.0.6</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2014-12-07</date>
|
||||
<notes>
|
||||
- Add two new ini options stomp.default_username and stomp.default_passowrd (Pierrick)
|
||||
- General performance improvements (Pierrick)
|
||||
- Fix stomp_read_frame when buffered (Pierrick)
|
||||
- Fixed bug #59217 (Connections to RabbitMQ via CLI). (Pierrick).
|
||||
- Fixed bug #59970 (acking a message makes rabbitmq disconnect the server). (Pierrick)
|
||||
- Fixed bug #67170 (Disable Nagle's Algorithm with TCP_NODELAY, it delays sending small messages). (Yarek Tyshchenko)
|
||||
- Fixed bug #68497 (Stomp client doesn't parse ERROR response on CONNECT). (Lorenzo Fontana)
|
||||
- Fixed bug #64671 (Add stomp_nack and Stomp::nack functions). (Pierrick)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.5</release><api>1.0.5</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2012-11-18</date>
|
||||
<notes>
|
||||
- Fix memory leak when Stomp can't write the message on the queue. (Pierrick)
|
||||
- Add a buffer for receipts. (Pierrick)
|
||||
- Fixed bug #62831 (Stomp module seems not initializing SSL library first).
|
||||
(Patch by lwhsu at lwhsu dot org)
|
||||
- Fixed bug #59972 (Message body are not binary safe). (Pierrick)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.4</release><api>1.0.4</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2012-09-17</date>
|
||||
<notes>
|
||||
- Fix compatibility with 5.4
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.3</release><api>1.0.3</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-10-12</date>
|
||||
<notes>
|
||||
- Fixed bug #18772 (setTimeout usecs not honored)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.2</release><api>1.0.2</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-08-13</date>
|
||||
<notes>
|
||||
- Fixed SSL connection bug introduced in 1.0.1
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.1</release><api>1.0.1</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-08-03</date>
|
||||
<notes>
|
||||
- Add new parameter to the constructor to allow client to send extra informations
|
||||
- Add zend engine runtime cache support (introduced into trunk)
|
||||
- Add new details property in the StompException class
|
||||
- Add new StompException::getDetails() method
|
||||
- Add the frame body content in the Stomp::Error() method
|
||||
- Fixed bug #17262 (Server is not responding on win32)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>1.0.0</release><api>1.0.0</api></version>
|
||||
<stability><release>stable</release><api>stable</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-02-11</date>
|
||||
<notes>
|
||||
- Bump to stable
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>0.4.1</release><api>0.4.1</api></version>
|
||||
<stability><release>beta</release><api>beta</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-01-19</date>
|
||||
<notes>
|
||||
- Fix compilation issue on PHP5.2 branch
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>0.4.0</release><api>0.4.0</api></version>
|
||||
<stability><release>beta</release><api>beta</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2010-01-17</date>
|
||||
<notes>
|
||||
- Adds the ability to specify an alternative class for readFrame
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>0.3.2</release><api>0.3.2</api></version>
|
||||
<stability><release>beta</release><api>beta</api></stability>
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2009-11-22</date>
|
||||
<notes>
|
||||
- Adds alt class
|
||||
- Fixed bug #16936 (Module segfaults on readFrame if Frame > STOMP_BUFSIZE)
|
||||
- Fixed bug #16933 (readFrame does not notice when server shuts down)
|
||||
- Fixed bug #16930 (readFrame reports error-frames as "timeout")
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
<version><release>0.3.1</release><api>0.3.1</api></version>
|
||||
<stability><release>beta</release><api>beta</api></stability>
|
||||
@@ -97,8 +232,8 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
- new stomp_connect_error() function (pierrick)
|
||||
- stomp_begin, stomp_abort and stomp_commit now accept additional headers (pierrick)
|
||||
- new connection timeout and read timeout ini configuration (pierrick)
|
||||
- Fix a memory leak in stomp_read_line (pierrick)
|
||||
- Better set of test (Pierrick and Anis)
|
||||
- Fix a memory leak in stomp_read_line (pierrick)
|
||||
- Better set of test (Pierrick and Anis)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
@@ -108,7 +243,7 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
<date>2009-11-01</date>
|
||||
<notes>
|
||||
- Windows build fix (kalle)
|
||||
- Add SSL support (pierrick)
|
||||
- Add SSL support (pierrick)
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
@@ -117,9 +252,8 @@ This extension allows php applications to communicate with any Stomp compliant M
|
||||
<license uri="http://www.php.net/license">PHP License</license>
|
||||
<date>2009-10-30</date>
|
||||
<notes>
|
||||
- Initial PECL release. (pierrick)
|
||||
- Initial PECL release. (pierrick)
|
||||
</notes>
|
||||
</release>
|
||||
</changelog>
|
||||
|
||||
</package>
|
||||
|
1529
php_stomp.c
Executable file → Normal file
1529
php_stomp.c
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
36
php_stomp.h
36
php_stomp.h
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -24,15 +24,12 @@
|
||||
#include "stomp.h"
|
||||
|
||||
typedef struct _stomp_object {
|
||||
zend_object std;
|
||||
stomp_t *stomp;
|
||||
zend_object std;
|
||||
stomp_t *stomp;
|
||||
} stomp_object_t;
|
||||
|
||||
#define PHP_STOMP_EXTNAME "Stomp"
|
||||
#define PHP_STOMP_MAJOR_VERSION "0"
|
||||
#define PHP_STOMP_MINOR_VERSION "3"
|
||||
#define PHP_STOMP_PATCH_VERSION "2"
|
||||
#define PHP_STOMP_VERSION PHP_STOMP_MAJOR_VERSION "." PHP_STOMP_MINOR_VERSION "." PHP_STOMP_PATCH_VERSION
|
||||
#define PHP_STOMP_VERSION "1.0.9-dev"
|
||||
|
||||
#define PHP_STOMP_RES_NAME "stomp connection"
|
||||
|
||||
@@ -81,23 +78,28 @@ PHP_FUNCTION(stomp_begin);
|
||||
PHP_FUNCTION(stomp_commit);
|
||||
PHP_FUNCTION(stomp_abort);
|
||||
PHP_FUNCTION(stomp_ack);
|
||||
PHP_FUNCTION(stomp_nack);
|
||||
PHP_FUNCTION(stomp_error);
|
||||
PHP_FUNCTION(stomp_set_read_timeout);
|
||||
PHP_FUNCTION(stomp_get_read_timeout);
|
||||
|
||||
PHP_METHOD(stompframe, __construct);
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(stomp)
|
||||
/* INI */
|
||||
char *default_broker;
|
||||
long read_timeout_sec;
|
||||
long read_timeout_usec;
|
||||
long connection_timeout_sec;
|
||||
long connection_timeout_usec;
|
||||
PHP_METHOD(stompexception, getDetails);
|
||||
|
||||
/* Others */
|
||||
long error_no;
|
||||
char *error_msg;
|
||||
ZEND_BEGIN_MODULE_GLOBALS(stomp)
|
||||
/* INI */
|
||||
char *default_broker;
|
||||
long read_timeout_sec;
|
||||
long read_timeout_usec;
|
||||
long connection_timeout_sec;
|
||||
long connection_timeout_usec;
|
||||
char *default_username;
|
||||
char *default_password;
|
||||
|
||||
/* Others */
|
||||
long error_no;
|
||||
char *error_msg;
|
||||
ZEND_END_MODULE_GLOBALS(stomp)
|
||||
|
||||
#ifdef ZTS
|
||||
|
87
stomp.h
Executable file → Normal file
87
stomp.h
Executable file → Normal file
@@ -2,7 +2,7 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP Version 5 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997-2009 The PHP Group |
|
||||
| Copyright (c) 1997-2010 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 3.01 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
@@ -30,45 +30,68 @@
|
||||
#define STOMP_BUFSIZE 4096
|
||||
|
||||
#define INIT_STOMP_FRAME(f) \
|
||||
f = (stomp_frame_t *) emalloc(sizeof(stomp_frame_t)); \
|
||||
f->command = NULL; f->body = NULL; \
|
||||
ALLOC_HASHTABLE(f->headers); \
|
||||
zend_hash_init(f->headers, 0, NULL, NULL, 0);
|
||||
f = (stomp_frame_t *) emalloc(sizeof(stomp_frame_t)); \
|
||||
f->command = NULL; f->body = NULL; \
|
||||
ALLOC_HASHTABLE(f->headers); \
|
||||
zend_hash_init(f->headers, 0, NULL, NULL, 0);
|
||||
|
||||
typedef struct _stomp {
|
||||
php_socket_t fd;
|
||||
php_sockaddr_storage localaddr;
|
||||
char *host;
|
||||
unsigned short port;
|
||||
int status;
|
||||
char *error;
|
||||
int errnum;
|
||||
long read_timeout_sec;
|
||||
long read_timeout_usec;
|
||||
char *session;
|
||||
typedef struct _stomp_options {
|
||||
long connect_timeout_sec;
|
||||
long connect_timeout_usec;
|
||||
long read_timeout_sec;
|
||||
long read_timeout_usec;
|
||||
#if HAVE_STOMP_SSL
|
||||
SSL *ssl_handle;
|
||||
int use_ssl;
|
||||
#endif
|
||||
} stomp_t;
|
||||
int use_ssl;
|
||||
#endif
|
||||
} stomp_options_t;
|
||||
|
||||
typedef struct _stomp_frame {
|
||||
char *command;
|
||||
int command_length;
|
||||
HashTable *headers;
|
||||
char *body;
|
||||
int body_length;
|
||||
char *command;
|
||||
int command_length;
|
||||
HashTable *headers;
|
||||
char *body;
|
||||
int body_length;
|
||||
} stomp_frame_t;
|
||||
|
||||
stomp_t *stomp_new(const char *host, unsigned short port, long read_timeout_sec, long read_timeout_usec TSRMLS_DC);
|
||||
int stomp_connect(stomp_t *stomp TSRMLS_DC);
|
||||
void stomp_close(stomp_t *stomp TSRMLS_DC);
|
||||
typedef struct _stomp_frame_stack {
|
||||
stomp_frame_t *frame;
|
||||
struct _stomp_frame_stack *next;
|
||||
} stomp_frame_stack_t;
|
||||
|
||||
typedef struct _stomp {
|
||||
php_socket_t fd;
|
||||
php_sockaddr_storage localaddr;
|
||||
stomp_options_t options;
|
||||
char *host;
|
||||
unsigned short port;
|
||||
int status;
|
||||
char *error;
|
||||
int errnum;
|
||||
char *error_details;
|
||||
char *session;
|
||||
#if HAVE_STOMP_SSL
|
||||
SSL *ssl_handle;
|
||||
#endif
|
||||
stomp_frame_stack_t *frame_stack;
|
||||
struct {
|
||||
size_t size;
|
||||
char buf[STOMP_BUFSIZE];
|
||||
char *pos;
|
||||
} read_buffer;
|
||||
} stomp_t;
|
||||
|
||||
stomp_t *stomp_init();
|
||||
int stomp_connect(stomp_t *stomp, const char *host, unsigned short port TSRMLS_DC);
|
||||
void stomp_close(stomp_t *stomp);
|
||||
int stomp_send(stomp_t *connection, stomp_frame_t *frame TSRMLS_DC);
|
||||
stomp_frame_t *stomp_read_frame(stomp_t *connection);
|
||||
stomp_frame_t *stomp_read_frame_ex(stomp_t *connection, int use_stack);
|
||||
int stomp_valid_receipt(stomp_t *connection, stomp_frame_t *frame);
|
||||
int stomp_select(stomp_t *connection);
|
||||
void stomp_set_error(stomp_t *stomp, const char *error, int errnum);
|
||||
void frame_destroy(stomp_frame_t *frame);
|
||||
int stomp_select_ex(stomp_t *connection, const long int sec, const long int usec);
|
||||
void stomp_set_error(stomp_t *stomp, const char *error, int errnum, const char *fmt, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 4, 0);
|
||||
void stomp_free_frame(stomp_frame_t *frame);
|
||||
|
||||
#define stomp_select(s) stomp_select_ex(s, s->options.read_timeout_sec, s->options.read_timeout_sec)
|
||||
#define stomp_read_frame(c) stomp_read_frame_ex(c, 1)
|
||||
#endif /* _STOMP_H_ */
|
||||
|
||||
/*
|
||||
|
@@ -7,4 +7,4 @@ Test stomp_version()
|
||||
echo stomp_version();
|
||||
?>
|
||||
--EXPECTF--
|
||||
%d.%d.%d
|
||||
%d.%d.%s
|
||||
|
14
tests/003-connect/003.phpt
Normal file
14
tests/003-connect/003.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test stomp_connect() - Test error on CONNECT
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("stomp")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
try {
|
||||
$stomp = new Stomp('tcp://localhost', 'anotpresentusername1234');
|
||||
} catch (Exception $e) {
|
||||
var_dump(get_class($e));
|
||||
}
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(14) "StompException"
|
@@ -14,7 +14,6 @@ stomp_send($link, '/queue/test-06', array());
|
||||
var_dump(stomp_send($link, '/queue/test-06', ''));
|
||||
var_dump(stomp_send($link, '/queue/test-06', 'A realMessage'));
|
||||
var_dump(stomp_send($link, '/queue/test-06', 'بياريك شارون'));
|
||||
var_dump(stomp_send($link, 'بياريك شارون', 'بياريك شارون', array('receipt' => 'message-123')), stomp_error($link));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
@@ -24,5 +23,3 @@ Warning: stomp_send(): Expects parameter %d to be a string or a StompFrame objec
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
string(%d) "%s"
|
||||
|
@@ -14,7 +14,6 @@ $s->send('/queue/test-06', array());
|
||||
var_dump($s->send('/queue/test-06', ''));
|
||||
var_dump($s->send('/queue/test-06', 'A realMessage'));
|
||||
var_dump($s->send('/queue/test-06', 'بياريك شارون'));
|
||||
var_dump($s->send('بياريك شارون', 'بياريك شارون', array('receipt' => 'message-123')), $s->error());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
@@ -24,5 +23,3 @@ Warning: Stomp::send(): Expects parameter %d to be a string or a StompFrame obje
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(false)
|
||||
string(%d) "%s"
|
||||
|
14
tests/006-send/003.phpt
Normal file
14
tests/006-send/003.phpt
Normal file
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test stomp::send() - test send with receipt
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("stomp")) print "skip";
|
||||
if (!stomp_connect()) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s = new Stomp();
|
||||
var_dump($s->send('/queue/test-06', 'A real message', array('receipt' => 'message-12345')));
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
@@ -14,4 +14,4 @@ $s->subscribe('/queue/test', 'string');
|
||||
--EXPECTF--
|
||||
Warning: Stomp::subscribe(): Destination can not be empty in %s on line %d
|
||||
|
||||
Catchable fatal error: Argument 2 passed to Stomp::subscribe() must be an array, string given in %s on line %d
|
||||
Catchable fatal error: Argument 2 passed to Stomp::subscribe() must be %s array, string given in %s on line %d
|
||||
|
@@ -14,4 +14,4 @@ $s->unsubscribe('/queue/test', 'string');
|
||||
--EXPECTF--
|
||||
Warning: Stomp::unsubscribe(): Destination can not be empty in %s on line %d
|
||||
|
||||
Catchable fatal error: Argument 2 passed to Stomp::unsubscribe() must be an array, string given in %s on line %d
|
||||
Catchable fatal error: Argument 2 passed to Stomp::unsubscribe() must be %s array, string given in %s on line %d
|
||||
|
@@ -9,9 +9,9 @@ Test stomp::readFrame() - tests functionnality and parameters
|
||||
<?php
|
||||
$s = new Stomp();
|
||||
$s->send('/queue/test-09', 'A test Message');
|
||||
$s->subscribe('/queue/test-09');
|
||||
$s->subscribe('/queue/test-09', array('ack' => 'auto'));
|
||||
var_dump($s->readFrame()->body);
|
||||
var_dump($s->readFrame('frame'));
|
||||
var_dump($s->readFrame());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
@@ -9,14 +9,12 @@ Test stomp_read_frame() - test functionnality and parameters
|
||||
<?php
|
||||
$link = stomp_connect();
|
||||
stomp_send($link, '/queue/test-09', 'A test Message');
|
||||
stomp_subscribe($link, '/queue/test-09');
|
||||
stomp_subscribe($link, '/queue/test-09', array('ack' => 'auto'));
|
||||
$result = stomp_read_frame($link);
|
||||
var_dump($result['body']);
|
||||
var_dump(stomp_read_frame($link, 'frame'));
|
||||
var_dump(stomp_read_frame($link));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(14) "A test Message"
|
||||
|
||||
Warning: stomp_read_frame() expects exactly 1 parameter, 2 given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
27
tests/009-readFrame/003.phpt
Normal file
27
tests/009-readFrame/003.phpt
Normal file
@@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Test stomp::readFrame() - custom frame class
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("stomp")) print "skip";
|
||||
if (!stomp_connect()) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class customFrame extends stompFrame
|
||||
{
|
||||
public function __construct($cmd, $headers, $body)
|
||||
{
|
||||
parent::__construct($cmd, $headers, $body);
|
||||
}
|
||||
}
|
||||
|
||||
$s = new Stomp();
|
||||
$s->send('/queue/test-09', 'A test Message');
|
||||
$s->subscribe('/queue/test-09', array('ack' => 'auto'));
|
||||
$frame = $s->readFrame('customFrame');
|
||||
var_dump(get_class($frame), $frame->body);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(11) "customFrame"
|
||||
string(14) "A test Message"
|
BIN
tests/009-readFrame/004.phpt
Normal file
BIN
tests/009-readFrame/004.phpt
Normal file
Binary file not shown.
BIN
tests/009-readFrame/005.phpt
Normal file
BIN
tests/009-readFrame/005.phpt
Normal file
Binary file not shown.
26
tests/009-readFrame/006.phpt
Normal file
26
tests/009-readFrame/006.phpt
Normal file
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
Test stomp::readFrame() - test frame stack
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded("stomp")) print "skip";
|
||||
if (!stomp_connect()) print "skip";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$s = new Stomp();
|
||||
var_dump($s->subscribe('/queue/test-buffer', array('ack' => 'auto')));
|
||||
var_dump($s->send('/queue/test-buffer', "Message1", array('receipt' => 'msg-1')));
|
||||
var_dump($s->send('/queue/test-buffer', "Message2", array('receipt' => 'msg-2')));
|
||||
var_dump($s->send('/queue/test-buffer', "Message3", array('receipt' => 'msg-3')));
|
||||
var_dump($s->readFrame()->body);
|
||||
var_dump($s->readFrame()->body);
|
||||
var_dump($s->readFrame()->body);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(8) "Message1"
|
||||
string(8) "Message2"
|
||||
string(8) "Message3"
|
@@ -17,7 +17,7 @@ var_dump($s->send('/queue/test-011-commit', 'bar', array('transaction' => 't1'))
|
||||
|
||||
// sends a message to the queue and asks for a receipt
|
||||
$s->send('/queue/test-011-commit', 'bar', array('transaction' => 't2', 'receipt' => 'tptp'));
|
||||
var_dump($s->error());
|
||||
echo gettype($s->error()) . PHP_EOL;
|
||||
|
||||
// commits a valid transaction
|
||||
var_dump($s->commit('t1'));
|
||||
@@ -28,15 +28,15 @@ var_dump($s->commit(null));
|
||||
|
||||
// commits a non valid transaction (a transaction id that does not exist) and asks for a receipt
|
||||
$s->commit('t2', array('receipt' => 'commit-key'));
|
||||
var_dump($s->error());
|
||||
echo gettype($s->error());
|
||||
|
||||
unset($s);
|
||||
?>
|
||||
--EXPECTF--
|
||||
bool(true)
|
||||
bool(true)
|
||||
string(%d) "Invalid transaction id: %s"
|
||||
string
|
||||
bool(true)
|
||||
bool(false)
|
||||
bool(true)
|
||||
string(%d) "Must specify the transaction you are committing"
|
||||
string
|
||||
|
@@ -19,7 +19,7 @@ try {
|
||||
$stomp->send($queue, $msg);
|
||||
|
||||
/* subscribe to messages from the queue 'foo' */
|
||||
$stomp->subscribe($queue);
|
||||
$stomp->subscribe($queue, array('ack' => 'auto'));
|
||||
|
||||
/* read a frame */
|
||||
$frame = $stomp->readFrame();
|
||||
|
Reference in New Issue
Block a user