Ejegg has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/332641 )
Change subject: Remove Stomp (!)
......................................................................
Remove Stomp (!)
Change-Id: I184b3a26581bc028a8d70752ae2d225d1abc50a2
---
M composer/autoload_namespaces.php
M composer/autoload_static.php
M composer/installed.json
D fusesource/stomp-php/.gitignore
D fusesource/stomp-php/.travis.yml
D fusesource/stomp-php/README.md
D fusesource/stomp-php/build.xml
D fusesource/stomp-php/composer.json
D fusesource/stomp-php/examples/activemq-connectivity.xml
D fusesource/stomp-php/examples/activemq-security.xml
D fusesource/stomp-php/examples/binary.php
D fusesource/stomp-php/examples/connectivity.php
D fusesource/stomp-php/examples/durable.php
D fusesource/stomp-php/examples/first.php
D fusesource/stomp-php/examples/security.php
D fusesource/stomp-php/examples/transactions.php
D fusesource/stomp-php/examples/transformation.php
D fusesource/stomp-php/phpunit.xml
D fusesource/stomp-php/src/FuseSource/Stomp/Exception/StompException.php
D fusesource/stomp-php/src/FuseSource/Stomp/ExceptionInterface.php
D fusesource/stomp-php/src/FuseSource/Stomp/Frame.php
D fusesource/stomp-php/src/FuseSource/Stomp/Message.php
D fusesource/stomp-php/src/FuseSource/Stomp/Message/Bytes.php
D fusesource/stomp-php/src/FuseSource/Stomp/Message/Map.php
D fusesource/stomp-php/src/FuseSource/Stomp/Stomp.php
D fusesource/stomp-php/tests/bootstrap.php
D fusesource/stomp-php/tests/functional/StompASyncTest.php
D fusesource/stomp-php/tests/functional/StompFailoverTest.php
D fusesource/stomp-php/tests/functional/StompRabbitTest.php
D fusesource/stomp-php/tests/functional/StompSslTest.php
D fusesource/stomp-php/tests/functional/StompSyncTest.php
D fusesource/stomp-php/tests/functional/StompTest.php
D fusesource/stomp-php/tests/stubbed/StompUnitTest.php
D fusesource/stomp-php/tests/stubbed/fusesource_stream_function_stubs.php
D fusesource/stomp-php/travisci/bin/ci/install_dependencies.sh
D fusesource/stomp-php/travisci/conf/amq/activemq.xml
36 files changed, 0 insertions(+), 3,078 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/SmashPig/vendor
refs/changes/41/332641/1
diff --git a/composer/autoload_namespaces.php b/composer/autoload_namespaces.php
index 1cb6750..9386d69 100644
--- a/composer/autoload_namespaces.php
+++ b/composer/autoload_namespaces.php
@@ -8,6 +8,5 @@
return array(
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
'PHPQueue' => array($vendorDir . '/coderkungfu/php-queue/src'),
- 'FuseSource' => array($vendorDir . '/fusesource/stomp-php/src'),
'Clio' => array($vendorDir . '/clio/clio/src'),
);
diff --git a/composer/autoload_static.php b/composer/autoload_static.php
index 2f4c3e5..49931c8 100644
--- a/composer/autoload_static.php
+++ b/composer/autoload_static.php
@@ -90,13 +90,6 @@
0 => __DIR__ . '/..' . '/coderkungfu/php-queue/src',
),
),
- 'F' =>
- array (
- 'FuseSource' =>
- array (
- 0 => __DIR__ . '/..' . '/fusesource/stomp-php/src',
- ),
- ),
'C' =>
array (
'Clio' =>
diff --git a/composer/installed.json b/composer/installed.json
index d062fd9..c947a30 100644
--- a/composer/installed.json
+++ b/composer/installed.json
@@ -83,58 +83,6 @@
]
},
{
- "name": "fusesource/stomp-php",
- "version": "2.1.1",
- "version_normalized": "2.1.1.0",
- "source": {
- "type": "git",
- "url": "https://github.com/dejanb/stomp-php.git",
- "reference": "4ac51c0abee05078e198faf13f48c056a72f8f8c"
- },
- "dist": {
- "type": "zip",
- "url":
"https://api.github.com/repos/dejanb/stomp-php/zipball/4ac51c0abee05078e198faf13f48c056a72f8f8c",
- "reference": "4ac51c0abee05078e198faf13f48c056a72f8f8c",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.0"
- },
- "time": "2013-02-23 17:34:44",
- "type": "library",
- "installation-source": "dist",
- "autoload": {
- "psr-0": {
- "FuseSource": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "Apache-2.0"
- ],
- "authors": [
- {
- "name": "Dejan Bosnanac",
- "email": "[email protected]",
- "homepage": "http://www.nighttale.net"
- },
- {
- "name": "Sören Rohweder",
- "email": "[email protected]",
- "homepage": "http://www.monofone.de"
- }
- ],
- "description": "stomp support for PHP",
- "homepage": "http://github.com/dejanb/stomp-php",
- "keywords": [
- "activeMQ",
- "jms",
- "messaging",
- "stomp"
- ],
- "abandoned": "stomp-php/stomp-php"
- },
- {
"name": "symfony/polyfill-mbstring",
"version": "v1.2.0",
"version_normalized": "1.2.0.0",
diff --git a/fusesource/stomp-php/.gitignore b/fusesource/stomp-php/.gitignore
deleted file mode 100644
index 46422e3..0000000
--- a/fusesource/stomp-php/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-nbproject
-composer.lock
-composer.phar
-vendor
diff --git a/fusesource/stomp-php/.travis.yml b/fusesource/stomp-php/.travis.yml
deleted file mode 100644
index 8baaf9f..0000000
--- a/fusesource/stomp-php/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: php
-php:
- - "5.4"
- - "5.3"
-before_script: ./travisci/bin/ci/install_dependencies.sh
-
diff --git a/fusesource/stomp-php/README.md b/fusesource/stomp-php/README.md
deleted file mode 100644
index 77f5962..0000000
--- a/fusesource/stomp-php/README.md
+++ /dev/null
@@ -1,64 +0,0 @@
-A simple PHP [Stomp](http://stomp.github.com) Client
-
-Version choice
---------------
-There are 2 Versions of stomp-php. 1.x is compatible with PHP <= PHP-5.2 as it
-does not use PHP-5.3 specific features.
-
-The master branch uses features such as namespaces and newer constants and will
-become the 2.x release in the near future.
-
-For versioning [semantic versioning](http://semver.org/) is used.
-
-The different Versions can be found at the [tags](stomp-php/tags)
-section.
-
-Installing
-----------
-
-The source is PSR-0 compliant. So just donwload the source and add the
Namespace
-"FuseSource" to your autoloader configuration with the path pointing to
-src/.
-
-As an alternate you have the possibility to make use of composer to manage your
-project dependencies.
-
-Just add
-
- "require": {
- "fusesource/stomp-php" : "2.0.*"
- }
-
-to your project composer.json.
-
-Running Examples
-----------------
-
-Examples are located in `src/examples` folder. Before running them, be sure
-you have installed this library properly and you have started ActiveMQ broker
-(recommended version 5.5.0 or above) with [Stomp connector enabled]
-(http://activemq.apache.org/stomp.html).
-
-You can start by running
-
- cd examples
- php first.php
-
-Also, be sure to check comments in the particular examples for some special
-configuration steps (if needed).
-
-Documentation
--------------
-
-* [Web Site](http://stomp.fusesource.org/documentation/php/)
-
-Tests
------
-
-The tests at the moment need a running instance of activeMQ listening on the
-default STOMP Port 61613.
-
-To run the tests you first need to fetch the dependencies for the test suite
-via composer:
-
- $ php composer.phar install
diff --git a/fusesource/stomp-php/build.xml b/fusesource/stomp-php/build.xml
deleted file mode 100644
index f0872ea..0000000
--- a/fusesource/stomp-php/build.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="stomp-cli" basedir="." default="deploy">
-
- <target name="clean" description="--> Clean output directories">
- <delete dir="target"/>
- </target>
-
- <target name="deploy" depends="clean" description="--> Deploy library">
- <mkdir dir="target"/>
- <tar destfile="target/stomp-php-1.1-SNAPSHOT.tar.gz" compression="gzip">
- <fileset dir="src/main/">
- <include name="**/*"/>
- </fileset>
- <tarfileset dir="src/examples" prefix="examples">
- <include name="**/*"/>
- </tarfileset>
- </tar>
- </target>
-</project>
\ No newline at end of file
diff --git a/fusesource/stomp-php/composer.json
b/fusesource/stomp-php/composer.json
deleted file mode 100644
index a632eb6..0000000
--- a/fusesource/stomp-php/composer.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "fusesource/stomp-php",
- "description": "stomp support for PHP",
- "keywords": ["messaging", "stomp", "jms", "activemq"],
- "homepage": "http://github.com/dejanb/stomp-php",
- "license": "Apache-2.0",
- "authors": [
- {
- "name": "Dejan Bosnanac",
- "email": "[email protected]",
- "homepage": "http://www.nighttale.net"
- },
- {
- "name": "Sören Rohweder",
- "email": "[email protected]",
- "homepage": "http://www.monofone.de"
- }
- ],
- "require": {
- "php": ">=5.3.0"
- },
- "autoload": {
- "psr-0": {
- "FuseSource": "src/"
- }
- }
-}
diff --git a/fusesource/stomp-php/examples/activemq-connectivity.xml
b/fusesource/stomp-php/examples/activemq-connectivity.xml
deleted file mode 100644
index 75d3ed6..0000000
--- a/fusesource/stomp-php/examples/activemq-connectivity.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- http://fusesource.com
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<beans>
- <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
- <broker useJmx="false" persistent="false"
xmlns="http://activemq.apache.org/schema/core" populateJMSXUserID="true">
-
- <transportConnectors>
- <transportConnector name="stomp+ssl"
uri="stomp+ssl://localhost:61612"/>
- </transportConnectors>
-
- <sslContext>
- <sslContext keyStore="file:${activemq.base}/conf/broker.ks"
- keyStorePassword="password"
trustStore="file:${activemq.base}/conf/broker.ts"
- trustStorePassword="password"/>
- </sslContext>
-
- </broker>
-
-</beans>
diff --git a/fusesource/stomp-php/examples/activemq-security.xml
b/fusesource/stomp-php/examples/activemq-security.xml
deleted file mode 100755
index 226e6ac..0000000
--- a/fusesource/stomp-php/examples/activemq-security.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!--
- Secure ActiveMQ broker
- For more information, see:
-
- http://activemq.apache.org/security.html
-
- To run ActiveMQ with this configuration add
xbean:conf/activemq-security.xml to your command
-
- e.g. $ bin/activemq xbean:conf/activemq-security.xml
- -->
-<beans
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:amq="http://activemq.apache.org/schema/core"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
-
- <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <value>file:${activemq.base}/conf/credentials.properties</value>
- </property>
- </bean>
-
- <broker useJmx="true" persistent="false"
xmlns="http://activemq.apache.org/schema/core">
-
- <plugins>
- <!-- Configure authentication; Username, passwords and groups -->
- <simpleAuthenticationPlugin>
- <users>
- <authenticationUser username="system" password="manager"
- groups="users,admins"/>
- <authenticationUser username="user" password="password"
- groups="users"/>
- <authenticationUser username="guest" password="password"
groups="guests"/>
- </users>
- </simpleAuthenticationPlugin>
-
-
- <!-- Lets configure a destination based authorization mechanism -->
- <authorizationPlugin>
- <map>
- <authorizationMap>
- <authorizationEntries>
- <authorizationEntry queue=">" read="admins" write="admins"
admin="admins" />
- <authorizationEntry queue="USERS.>" read="users" write="users"
admin="users" />
- <authorizationEntry queue="GUEST.>" read="guests"
write="guests,users" admin="guests,users" />
-
- <authorizationEntry queue="TEST.Q" read="guests" write="guests"
/>
-
- <authorizationEntry topic=">" read="admins" write="admins"
admin="admins" />
- <authorizationEntry topic="USERS.>" read="users" write="users"
admin="users" />
- <authorizationEntry topic="GUEST.>" read="guests"
write="guests,users" admin="guests,users" />
-
- <authorizationEntry topic="ActiveMQ.Advisory.>"
read="guests,users" write="guests,users" admin="guests,users"/>
- </authorizationEntries>
- </authorizationMap>
- </map>
- </authorizationPlugin>
- </plugins>
-
- <transportConnectors>
- <transportConnector name="default" uri="stomp://0.0.0.0:61613"/>
- </transportConnectors>
-
- </broker>
-
-</beans>
diff --git a/fusesource/stomp-php/examples/binary.php
b/fusesource/stomp-php/examples/binary.php
deleted file mode 100644
index a6d84fa..0000000
--- a/fusesource/stomp-php/examples/binary.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// include a library
-use FuseSource\Stomp\Stomp;
-use FuseSource\Stomp\Message\Bytes;
-// make a connection
-$con = new Stomp("tcp://localhost:61613");
-// connect
-$con->connect();
-// send a message to the queue
-$body = "test";
-$bytesMessage = new Bytes($body);
-$con->send("/queue/test", $bytesMessage);
-echo "Sending message: ";
-print_r($body . "\n");
-
-$con->subscribe("/queue/test");
-$msg = $con->readFrame();
-
-// extract
-if ( $msg != null) {
- echo "Received message: ";
- print_r($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();
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/connectivity.php
b/fusesource/stomp-php/examples/connectivity.php
deleted file mode 100644
index d184bb5..0000000
--- a/fusesource/stomp-php/examples/connectivity.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- To successfully run this example, you must first start the broker with
stomp+ssl enabled.
- You can do that by executing:
- $ ${ACTIVEMQ_HOME}/bin/activemq xbean:activemq-connectivity.xml
- Then you can execute this example with:
- $ php connectivity.php
-*/
-// include a library
-
-use FuseSource\Stomp\Stomp;
-// make a connection
-$con = new
Stomp("failover://(tcp://localhost:61614,ssl://localhost:61612)?randomize=false");
-// connect
-$con->connect();
-// 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();
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/durable.php
b/fusesource/stomp-php/examples/durable.php
deleted file mode 100644
index d061cd6..0000000
--- a/fusesource/stomp-php/examples/durable.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// include a library
-
-use FuseSource\Stomp\Stomp;
-
-// create a producer
-$producer = new Stomp("tcp://localhost:61613");
-// create a consumer
-$consumer = new Stomp("tcp://localhost:61613");
-$consumer->setReadTimeout(1);
-// set clientId on a consumer to make it durable
-$consumer->clientId = "test";
-// connect
-$producer->connect();
-$consumer->connect();
-// subscribe to the topic
-$consumer->subscribe("/topic/test");
-
-sleep(1);
-
-// send a message to the topic
-$producer->send("/topic/test", "test", array('persistent'=>'true'));
-echo "Message 'test' sent to topic\n";
-
-// receive a message from the topic
-$msg = $consumer->readFrame();
-
-// do what you want with the message
-if ( $msg != null) {
- echo "Message '$msg->body' received from topic\n";
- $consumer->ack($msg);
-} else {
- echo "Failed to receive a message\n";
-}
-
-sleep(1);
-
-// disconnect durable consumer
-$consumer->unsubscribe("/topic/test");
-$consumer->disconnect();
-echo "Disconnecting consumer\n";
-
-// send a message while consumer is disconnected
-// note: only persistent messages will be redelivered to the durable consumer
-$producer->send("/topic/test", "test1", array('persistent'=>'true'));
-echo "Message 'test1' sent to topic\n";
-
-
-// reconnect the durable consumer
-$consumer = new Stomp("tcp://localhost:61613");
-$consumer->clientId = "test";
-$consumer->connect();
-$consumer->subscribe("/topic/test");
-echo "Reconnecting consumer\n";
-
-// receive a message from the topic
-$msg = $consumer->readFrame();
-
-// do what you want with the message
-if ( $msg != null) {
- echo "Message '$msg->body' received from topic\n";
- $consumer->ack($msg);
-} else {
- echo "Failed to receive a message\n";
-}
-
-// disconnect
-$consumer->unsubscribe("/topic/test");
-$consumer->disconnect();
-$producer->disconnect();
-
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/first.php
b/fusesource/stomp-php/examples/first.php
deleted file mode 100644
index 6018ada..0000000
--- a/fusesource/stomp-php/examples/first.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// include a library
-
-use FuseSource\Stomp\Stomp;
-// make a connection
-$con = new Stomp("tcp://localhost:61613");
-// connect
-$con->connect();
-// 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();
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/security.php
b/fusesource/stomp-php/examples/security.php
deleted file mode 100644
index 2437cb3..0000000
--- a/fusesource/stomp-php/examples/security.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- To successfully run this example, you must first start the broker with
security enabled.
- You can do that by executing:
- $ ${ACTIVEMQ_HOME}/bin/activemq xbean:activemq-security.xml
- Then you can execute this example with:
- $ php security.php
-*/
-// include a library
-use FuseSource\Stomp\Stomp;
-use FuseSource\Stomp\Exception\StompException;
-
-// make a connection
-$con = new Stomp("tcp://localhost:61613");
-// use sync operations
-$con->sync = true;
-// connect
-try {
- $con->connect("dejan", "test");
-} catch (StompException $e) {
- echo "dejan cannot connect\n";
- echo $e->getMessage() . "\n";
- echo $e->getDetails() . "\n\n\n";
-}
-
-$con->connect("guest", "password");
-
-// send a message to the queue
-try {
- $con->send("/queue/test", "test");
- echo "Guest sent message with body 'test'\n";
-} catch (StompException $e) {
- echo "guest cannot send\n";
- echo $e->getMessage() . "\n";
- echo $e->getDetails() . "\n\n\n";
-}
-// disconnect
-$con->disconnect();
-
-
-$con->connect("system", "manager");
-
-// send a message to the queue
-$con->send("/queue/test", "test");
-echo "System manager sent message with body 'test'\n";
-
-// disconnect
-$con->disconnect();
-
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/transactions.php
b/fusesource/stomp-php/examples/transactions.php
deleted file mode 100644
index ccc6c3a..0000000
--- a/fusesource/stomp-php/examples/transactions.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// include a library
-use FuseSource\Stomp\Stomp;
-// make a connection
-$con = new Stomp("tcp://localhost:61613");
-// connect
-$con->connect();
-$con->setReadTimeout(1);
-
-// subscribe to the queue
-$con->subscribe("/queue/transactions", array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
-// try to send some messages
-$con->begin("tx1");
-for ($i = 1; $i < 3; $i++) {
- $con->send("/queue/transactions", $i, array("transaction" => "tx1"));
-}
-// if we abort transaction, messages will not be sent
-$con->abort("tx1");
-
-// now send some messages for real
-$con->begin("tx2");
-echo "Sent messages {\n";
-for ($i = 1; $i < 5; $i++) {
- echo "\t$i\n";
- $con->send("/queue/transactions", $i, array("transaction" => "tx2"));
-}
-echo "}\n";
-// they will be available for consumers after commit
-$con->commit("tx2");
-
-// try to receive some messages
-$con->begin("tx3");
-$messages = array();
-for ($i = 1; $i < 3; $i++) {
- $msg = $con->readFrame();
- array_push($messages, $msg);
- $con->ack($msg, "tx3");
-}
-// of we abort transaction, we will "rollback" out acks
-$con->abort("tx3");
-
-$con->begin("tx4");
-// so we need to ack received messages again
-// before we can receive more (prefetch = 1)
-if (count($messages) != 0) {
- foreach($messages as $msg) {
- $con->ack($msg, "tx4");
- }
-}
-// now receive more messages
-for ($i = 1; $i < 3; $i++) {
- $msg = $con->readFrame();
- $con->ack($msg, "tx4");
- array_push($messages, $msg);
-}
-// commit all acks
-$con->commit("tx4");
-
-
-echo "Processed messages {\n";
-foreach($messages as $msg) {
- echo "\t$msg->body\n";
-}
-echo "}\n";
-
-//ensure there are no more messages in the queue
-$frame = $con->readFrame();
-
-if ($frame === false) {
- echo "No more messages in the queue\n";
-} else {
- echo "Warning: some messages still in the queue: $frame\n";
-}
-
-// disconnect
-$con->disconnect();
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/examples/transformation.php
b/fusesource/stomp-php/examples/transformation.php
deleted file mode 100644
index fcb552f..0000000
--- a/fusesource/stomp-php/examples/transformation.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-require __DIR__.'/../vendor/autoload.php';
-/**
- *
- * Copyright (C) 2009 Progress Software, Inc. All rights reserved.
- * http://fusesource.com
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// include a library
-use FuseSource\Stomp\Stomp;
-use FuseSource\Stomp\Message\Map;
-// make a connection
-$con = new Stomp("tcp://localhost:61613");
-// connect
-$con->connect();
-// send a message to the queue
-$body = array("city"=>"Belgrade", "name"=>"Dejan");
-$header = array();
-$header['transformation'] = 'jms-map-json';
-$mapMessage = new Map($body, $header);
-$con->send("/queue/test", $mapMessage);
-echo "Sending array: ";
-print_r($body);
-
-$con->subscribe("/queue/test", array('transformation' => 'jms-map-json'));
-$msg = $con->readFrame();
-
-// extract
-if ( $msg != null) {
- echo "Received array: ";
- print_r($msg->map);
- // mark the message as received in the queue
- $con->ack($msg);
-} else {
- echo "Failed to receive a message\n";
-}
-
-// disconnect
-$con->disconnect();
-?>
\ No newline at end of file
diff --git a/fusesource/stomp-php/phpunit.xml b/fusesource/stomp-php/phpunit.xml
deleted file mode 100644
index 68ee9c5..0000000
--- a/fusesource/stomp-php/phpunit.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html -->
-<phpunit
- backupGlobals = "false"
- backupStaticAttributes = "false"
- colors = "true"
- convertErrorsToExceptions = "true"
- convertNoticesToExceptions = "true"
- convertWarningsToExceptions = "true"
- processIsolation = "false"
- stopOnFailure = "false"
- syntaxCheck = "false"
- bootstrap = "tests/bootstrap.php" >
- <testsuites>
- <testsuite name="stomp-php Functional Test Suite">
- <directory>tests/functional/</directory>
- </testsuite>
- <testsuite name="stomp-php Stubbed Test Suite">
- <file>tests/stubbed</file>
- </testsuite>
- </testsuites>
-</phpunit>
diff --git
a/fusesource/stomp-php/src/FuseSource/Stomp/Exception/StompException.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Exception/StompException.php
deleted file mode 100755
index accbaa7..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Exception/StompException.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-namespace FuseSource\Stomp\Exception;
-
-use FuseSource\Stomp\ExceptionInterface;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * A Stomp Connection
- *
- *
- * @package Stomp
- */
-class StompException extends \Exception implements ExceptionInterface
-{
- protected $_details;
-
- /**
- * Constructor
- *
- * @param string $message Error message
- * @param int $code Error code
- * @param string $details Stomp server error details
- */
- public function __construct($message = null, $code = 0, $details = '')
- {
- $this->_details = $details;
-
- parent::__construct($message, $code);
- }
-
- /**
- * Stomp server error details
- *
- * @return string
- */
- public function getDetails()
- {
- return $this->_details;
- }
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/ExceptionInterface.php
b/fusesource/stomp-php/src/FuseSource/Stomp/ExceptionInterface.php
deleted file mode 100644
index 86ff86d..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/ExceptionInterface.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace FuseSource\Stomp;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- *
- * @author srohweder
- */
-interface ExceptionInterface
-{
- //put your code here
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/Frame.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Frame.php
deleted file mode 100755
index c1d3f74..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Frame.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-namespace FuseSource\Stomp;
-
-use FuseSource\Stomp\Exception\StompException;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * Stomp Frames are messages that are sent and received on a stomp connection.
- *
- * @package Stomp
- */
-class Frame
-{
- public $command;
- public $headers = array();
- public $body;
-
- /**
- * Constructor
- *
- * @param string $command
- * @param array $headers
- * @param string $body
- */
- public function __construct ($command = null, $headers = null, $body =
null)
- {
- $this->_init($command, $headers, $body);
- }
-
- protected function _init ($command = null, $headers = null, $body = null)
- {
- $this->command = $command;
- if ($headers != null) {
- $this->headers = $headers;
- }
- $this->body = $body;
-
- if ($this->command == 'ERROR') {
- throw new StompException($this->headers['message'], 0,
$this->body);
- }
- }
-
- /**
- * Convert frame to transportable string
- *
- * @return string
- */
- public function __toString()
- {
- $data = $this->command . "\n";
-
- foreach ($this->headers as $name => $value) {
- $data .= $name . ":" . $value . "\n";
- }
-
- $data .= "\n";
- $data .= $this->body;
- return $data .= "\x00";
- }
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/Message.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Message.php
deleted file mode 100755
index 1cbeb08..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Message.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-namespace FuseSource\Stomp;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-
-/**
- * Basic text stomp message
- *
- * @package Stomp
- */
-class Message extends Frame
-{
- public function __construct ($body, $headers = null)
- {
- $this->_init("SEND", $headers, $body);
- }
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/Message/Bytes.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Message/Bytes.php
deleted file mode 100755
index 718d6fb..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Message/Bytes.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-namespace FuseSource\Stomp\Message;
-
-use FuseSource\Stomp\Message;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * Message that contains a stream of uninterpreted bytes
- *
- * @package Stomp
- */
-class Bytes extends Message
-{
- /**
- * Constructor
- *
- * @param string $body
- * @param array $headers
- */
- function __construct ($body, $headers = null)
- {
- $this->_init("SEND", $headers, $body);
- if ($this->headers == null) {
- $this->headers = array();
- }
- $this->headers['content-length'] = count(unpack("c*", $body));
- }
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/Message/Map.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Message/Map.php
deleted file mode 100755
index f5ddd51..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Message/Map.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-namespace FuseSource\Stomp\Message;
-
-use FuseSource\Stomp\Message;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-
-/**
- * Message that contains a set of name-value pairs
- *
- * @package Stomp
- */
-class Map extends Message
-{
- public $map;
-
- /**
- * Constructor
- *
- * @param StompFrame|string $msg
- * @param array $headers
- */
- function __construct ($msg, $headers = null)
- {
- if ($msg instanceof \FuseSource\Stomp\Frame) {
- $this->_init($msg->command, $msg->headers, $msg->body);
- $this->map = json_decode($msg->body, true);
- } else {
- $this->_init("SEND", $headers, $msg);
- if ($this->headers == null) {
- $this->headers = array();
- }
- $this->headers['transformation'] = 'jms-map-json';
- $this->body = json_encode($msg);
- }
- }
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/src/FuseSource/Stomp/Stomp.php
b/fusesource/stomp-php/src/FuseSource/Stomp/Stomp.php
deleted file mode 100755
index 29491e7..0000000
--- a/fusesource/stomp-php/src/FuseSource/Stomp/Stomp.php
+++ /dev/null
@@ -1,647 +0,0 @@
-<?php
-
-namespace FuseSource\Stomp;
-
-use FuseSource\Stomp\Exception\StompException;
-use FuseSource\Stomp\Message\Map;
-
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * A Stomp Connection
- *
- *
- * @package Stomp
- * @author Hiram Chirino <[email protected]>
- * @author Dejan Bosanac <[email protected]>
- * @author Michael Caplan <[email protected]>
- * @version $Revision: 43 $
- */
-class Stomp
-{
- /**
- * Perform request synchronously
- *
- * @var boolean
- */
- public $sync = false;
-
- /**
- * Default prefetch size
- *
- * @var int
- */
- public $prefetchSize = 1;
-
- /**
- * Client id used for durable subscriptions
- *
- * @var string
- */
- public $clientId = null;
-
- /**
- * Vendor flavouring (AMQ or RMQ at the moment)
- */
- public $brokerVendor = 'AMQ';
-
- protected $_brokerUri = null;
- protected $_socket = null;
- protected $_hosts = array();
- protected $_params = array();
- protected $_subscriptions = array();
- protected $_defaultPort = 61613;
- protected $_currentHost = - 1;
- protected $_attempts = 10;
- protected $_username = '';
- protected $_password = '';
- protected $_sessionId;
- protected $_read_timeout_seconds = 60;
- protected $_read_timeout_milliseconds = 0;
- protected $_connect_timeout_seconds = 60;
- protected $_waitbuf = array();
-
- /**
- * Constructor
- *
- * @param string $brokerUri Broker URL
- * @throws StompException
- */
- public function __construct ($brokerUri)
- {
- $this->_brokerUri = $brokerUri;
- $this->_init();
- }
- /**
- * Initialize connection
- *
- * @throws StompException
- */
- protected function _init ()
- {
- $pattern =
"|^(([a-zA-Z0-9]+)://)+\(*([a-zA-Z0-9\.:/i,-]+)\)*\??([a-zA-Z0-9=&]*)$|i";
- if (preg_match($pattern, $this->_brokerUri, $regs)) {
- $scheme = $regs[2];
- $hosts = $regs[3];
- $params = $regs[4];
- if ($scheme != "failover") {
- $this->_processUrl($this->_brokerUri);
- } else {
- $urls = explode(",", $hosts);
- foreach ($urls as $url) {
- $this->_processUrl($url);
- }
- }
- if ($params != null) {
- parse_str($params, $this->_params);
- }
- } else {
- throw new StompException("Bad Broker URL {$this->_brokerUri}");
- }
- }
- /**
- * Process broker URL
- *
- * @param string $url Broker URL
- * @throws StompException
- * @return boolean
- */
- protected function _processUrl ($url)
- {
- $parsed = parse_url($url);
- if ($parsed) {
- array_push($this->_hosts, array($parsed['host'] , $parsed['port']
, $parsed['scheme']));
- } else {
- throw new StompException("Bad Broker URL $url");
- }
- }
- /**
- * Make socket connection to the server
- *
- * @throws StompException
- */
- protected function _makeConnection ()
- {
- if (count($this->_hosts) == 0) {
- throw new StompException("No broker defined");
- }
-
- // force disconnect, if previous established connection exists
- $this->disconnect();
-
- $i = $this->_currentHost;
- $att = 0;
- $connected = false;
- $connect_errno = null;
- $connect_errstr = null;
-
- while (! $connected && $att ++ < $this->_attempts) {
- if (isset($this->_params['randomize']) &&
$this->_params['randomize'] == 'true') {
- $i = rand(0, count($this->_hosts) - 1);
- } else {
- $i = ($i + 1) % count($this->_hosts);
- }
- $broker = $this->_hosts[$i];
- $host = $broker[0];
- $port = $broker[1];
- $scheme = $broker[2];
- if ($port == null) {
- $port = $this->_defaultPort;
- }
- if ($this->_socket != null) {
- fclose($this->_socket);
- $this->_socket = null;
- }
- $this->_socket = @fsockopen($scheme . '://' . $host, $port,
$connect_errno, $connect_errstr, $this->_connect_timeout_seconds);
- if (!is_resource($this->_socket) && $att >= $this->_attempts &&
!array_key_exists($i + 1, $this->_hosts)) {
- throw new StompException("Could not connect to $host:$port
($att/{$this->_attempts})");
- } else if (is_resource($this->_socket)) {
- $connected = true;
- $this->_currentHost = $i;
- break;
- }
- }
- if (! $connected) {
- throw new StompException("Could not connect to a broker");
- }
- }
- /**
- * Connect to server
- *
- * @param string $username
- * @param string $password
- * @return boolean
- * @throws StompException
- */
- public function connect ($username = '', $password = '')
- {
- $this->_makeConnection();
- if ($username != '') {
- $this->_username = $username;
- }
- if ($password != '') {
- $this->_password = $password;
- }
- $headers = array('login' => $this->_username , 'passcode' =>
$this->_password);
- if ($this->clientId != null) {
- $headers["client-id"] = $this->clientId;
- }
- $frame = new Frame("CONNECT", $headers);
- $this->_writeFrame($frame);
- $frame = $this->readFrame();
-
- if ($frame instanceof Frame && $frame->command == 'CONNECTED') {
- $this->_sessionId = $frame->headers["session"];
- if (isset($frame->headers['server']) && false !==
stristr(trim($frame->headers['server']), 'rabbitmq')) {
- $this->brokerVendor = 'RMQ';
- }
- return true;
- } else {
- if ($frame instanceof Frame) {
- throw new StompException("Unexpected command:
{$frame->command}", 0, $frame->body);
- } else {
- throw new StompException("Connection not acknowledged");
- }
- }
- }
-
- /**
- * Check if client session has ben established
- *
- * @return boolean
- */
- public function isConnected ()
- {
- return !empty($this->_sessionId) && is_resource($this->_socket);
- }
- /**
- * Current stomp session ID
- *
- * @return string
- */
- public function getSessionId()
- {
- return $this->_sessionId;
- }
- /**
- * Send a message to a destination in the messaging system
- *
- * @param string $destination Destination queue
- * @param string|Frame $msg Message
- * @param array $properties
- * @param boolean $sync Perform request synchronously
- * @return boolean
- */
- public function send ($destination, $msg, $properties = array(), $sync =
null)
- {
- if ($msg instanceof Frame) {
- $msg->headers['destination'] = $destination;
- if (is_array($properties)) $msg->headers =
array_merge($msg->headers, $properties);
- $frame = $msg;
- } else {
- $headers = $properties;
- $headers['destination'] = $destination;
- $frame = new Frame('SEND', $headers, $msg);
- }
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- return $this->_waitForReceipt($frame, $sync);
- }
- /**
- * Prepair frame receipt
- *
- * @param Frame $frame
- * @param boolean $sync
- */
- protected function _prepareReceipt (Frame $frame, $sync)
- {
- $receive = $this->sync;
- if ($sync !== null) {
- $receive = $sync;
- }
- if ($receive == true) {
- $frame->headers['receipt'] = md5(microtime());
- }
- }
- /**
- * Wait for receipt
- *
- * @param Frame $frame
- * @param boolean $sync
- * @return boolean
- * @throws StompException
- */
- protected function _waitForReceipt (Frame $frame, $sync)
- {
-
- $receive = $this->sync;
- if ($sync !== null) {
- $receive = $sync;
- }
- if ($receive == true) {
- $id = (isset($frame->headers['receipt'])) ?
$frame->headers['receipt'] : null;
- if ($id == null) {
- return true;
- }
-
- $buf = array();
- while(true) {
- $frame = $this->readFrame();
- if ($frame == false) {
- if (!empty($buf)) {
- $this->_waitbuf = $buf;
- return false;
- }
- }
- if ($frame instanceof Frame && $frame->command == 'RECEIPT') {
- if ($frame->headers['receipt-id'] == $id) {
- $this->_waitbuf = $buf;
- return true;
- } else {
- throw new StompException("Unexpected receipt id
{$frame->headers['receipt-id']}", 0, $frame->body);
- }
- } else {
- $buf[] = $frame;
- }
- }
- }
- return true;
- }
- /**
- * Register to listen to a given destination
- *
- * @param string $destination Destination queue
- * @param array $properties
- * @param boolean $sync Perform request synchronously
- * @return boolean
- * @throws StompException
- */
- public function subscribe ($destination, $properties = null, $sync = null)
- {
- $headers = array('ack' => 'client');
- if ($this->brokerVendor == 'AMQ') {
- $headers['activemq.prefetchSize'] = $this->prefetchSize;
- } else if ($this->brokerVendor == 'RMQ') {
- $headers['prefetch-count'] = $this->prefetchSize;
- }
-
- if ($this->clientId != null) {
- if ($this->brokerVendor == 'AMQ') {
- $headers['activemq.subscriptionName'] = $this->clientId;
- } else if ($this->brokerVendor == 'RMQ') {
- $headers['id'] = $this->clientId;
- }
- }
-
- if (isset($properties)) {
- foreach ($properties as $name => $value) {
- $headers[$name] = $value;
- }
- }
- $headers['destination'] = $destination;
- $frame = new Frame('SUBSCRIBE', $headers);
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- if ($this->_waitForReceipt($frame, $sync) == true) {
- $this->_subscriptions[$destination] = $properties;
- return true;
- } else {
- return false;
- }
- }
- /**
- * Remove an existing subscription
- *
- * @param string $destination
- * @param array $properties
- * @param boolean $sync Perform request synchronously
- * @return boolean
- * @throws StompException
- */
- public function unsubscribe ($destination, $properties = null, $sync =
null)
- {
- $headers = array();
- if (isset($properties)) {
- foreach ($properties as $name => $value) {
- $headers[$name] = $value;
- }
- }
- if ($this->clientId != null) {
- if ($this->brokerVendor == 'RMQ') {
- $headers['id'] = $this->clientId;
- }
- }
- $headers['destination'] = $destination;
- $frame = new Frame('UNSUBSCRIBE', $headers);
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- if ($this->_waitForReceipt($frame, $sync) == true) {
- unset($this->_subscriptions[$destination]);
- return true;
- } else {
- return false;
- }
- }
- /**
- * Start a transaction
- *
- * @param string $transactionId
- * @param boolean $sync Perform request synchronously
- * @return boolean
- * @throws StompException
- */
- public function begin ($transactionId = null, $sync = null)
- {
- $headers = array();
- if (isset($transactionId)) {
- $headers['transaction'] = $transactionId;
- }
- $frame = new Frame('BEGIN', $headers);
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- return $this->_waitForReceipt($frame, $sync);
- }
- /**
- * Commit a transaction in progress
- *
- * @param string $transactionId
- * @param boolean $sync Perform request synchronously
- * @return boolean
- * @throws StompException
- */
- public function commit ($transactionId = null, $sync = null)
- {
- $headers = array();
- if (isset($transactionId)) {
- $headers['transaction'] = $transactionId;
- }
- $frame = new Frame('COMMIT', $headers);
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- return $this->_waitForReceipt($frame, $sync);
- }
- /**
- * Roll back a transaction in progress
- *
- * @param string $transactionId
- * @param boolean $sync Perform request synchronously
- */
- public function abort ($transactionId = null, $sync = null)
- {
- $headers = array();
- if (isset($transactionId)) {
- $headers['transaction'] = $transactionId;
- }
- $frame = new Frame('ABORT', $headers);
- $this->_prepareReceipt($frame, $sync);
- $this->_writeFrame($frame);
- return $this->_waitForReceipt($frame, $sync);
- }
- /**
- * Acknowledge consumption of a message from a subscription
- * Note: This operation is always asynchronous
- *
- * @param string|Frame $messageMessage ID
- * @param string $transactionId
- * @return boolean
- * @throws StompException
- */
- public function ack ($message, $transactionId = null)
- {
- if ($message instanceof Frame) {
- $headers = $message->headers;
- if (isset($transactionId)) {
- $headers['transaction'] = $transactionId;
- }
-
- if ($this->brokerVendor == 'RMQ') {
- unset($headers['content-length']);
- }
- $frame = new Frame('ACK', $headers);
- $this->_writeFrame($frame);
- return true;
- } else {
- $headers = array();
- if (isset($transactionId)) {
- $headers['transaction'] = $transactionId;
- }
- $headers['message-id'] = $message;
- $frame = new Frame('ACK', $headers);
- $this->_writeFrame($frame);
- return true;
- }
- }
- /**
- * Graceful disconnect from the server
- *
- */
- public function disconnect ()
- {
- $headers = array();
-
- if ($this->clientId != null) {
- $headers["client-id"] = $this->clientId;
- }
-
- if (is_resource($this->_socket)) {
- $this->_writeFrame(new Frame('DISCONNECT', $headers));
- fclose($this->_socket);
- }
- $this->_socket = null;
- $this->_sessionId = null;
- $this->_currentHost = -1;
- $this->_subscriptions = array();
- $this->_username = '';
- $this->_password = '';
- $this->_waitbuf = array();
- }
- /**
- * Write frame to server
- *
- * @param Frame $stompFrame
- */
- protected function _writeFrame (Frame $stompFrame)
- {
- if (!is_resource($this->_socket)) {
- throw new StompException('Socket connection hasn\'t been
established');
- }
-
- $data = $stompFrame->__toString();
- $r = fwrite($this->_socket, $data, strlen($data));
- if ($r === false || $r == 0) {
- $this->_reconnect();
- $this->_writeFrame($stompFrame);
- }
- }
-
- /**
- * Set timeout to wait for content to read
- *
- * @param int $seconds_to_wait Seconds to wait for a frame
- * @param int $milliseconds Milliseconds to wait for a frame
- */
- public function setReadTimeout($seconds, $milliseconds = 0)
- {
- $this->_read_timeout_seconds = $seconds;
- $this->_read_timeout_milliseconds = $milliseconds;
- }
-
- /**
- * Read response frame from server
- *
- * @return Frame False when no frame to read
- */
- public function readFrame ()
- {
- if (!empty($this->_waitbuf)) {
- return array_shift($this->_waitbuf);
- }
-
- if (!$this->hasFrameToRead()) {
- return false;
- }
-
- $rb = 1024;
- $data = '';
- $end = false;
-
- do {
- $read = fgets($this->_socket, $rb);
- if ($read === false || $read === "") {
- $this->_reconnect();
- return $this->readFrame();
- }
- $data .= $read;
- if (strpos($data, "\x00") !== false) {
- $end = true;
- $data = trim($data, "\n");
- }
- $len = strlen($data);
- } while ($len < 2 || $end == false);
-
- list ($header, $body) = explode("\n\n", $data, 2);
- $header = explode("\n", $header);
- $headers = array();
- $command = null;
- foreach ($header as $v) {
- if (isset($command)) {
- list ($name, $value) = explode(':', $v, 2);
- $headers[$name] = $value;
- } else {
- $command = $v;
- }
- }
- $frame = new Frame($command, $headers, trim($body));
- if (isset($frame->headers['transformation']) &&
$frame->headers['transformation'] == 'jms-map-json') {
- return new Map($frame);
- } else {
- return $frame;
- }
- return $frame;
- }
-
- /**
- * Check if there is a frame to read
- *
- * @return boolean
- */
- public function hasFrameToRead()
- {
- $read = array($this->_socket);
- $write = null;
- $except = null;
-
- $has_frame_to_read = @stream_select($read, $write, $except,
$this->_read_timeout_seconds, $this->_read_timeout_milliseconds);
-
- if ($has_frame_to_read !== false)
- $has_frame_to_read = count($read);
-
-
- if ($has_frame_to_read === false) {
- throw new StompException('Check failed to determine if the socket
is readable');
- } else if ($has_frame_to_read > 0) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Reconnects and renews subscriptions (if there were any)
- * Call this method when you detect connection problems
- */
- protected function _reconnect ()
- {
- $subscriptions = $this->_subscriptions;
-
- $this->connect($this->_username, $this->_password);
- foreach ($subscriptions as $dest => $properties) {
- $this->subscribe($dest, $properties);
- }
- }
- /**
- * Graceful object desruction
- *
- */
- public function __destruct()
- {
- $this->disconnect();
- }
-}
diff --git a/fusesource/stomp-php/tests/bootstrap.php
b/fusesource/stomp-php/tests/bootstrap.php
deleted file mode 100644
index 811fd49..0000000
--- a/fusesource/stomp-php/tests/bootstrap.php
+++ /dev/null
@@ -1,9 +0,0 @@
-<?php
-
-if (!file_exists(__DIR__ . '/../vendor/autoload.php')) {
- echo "Please install the dependencies via composer in order to run the
tests.\n";
- echo "See http://getcomposer.org for more information.\n";
- exit(1);
-}
-
-require __DIR__ . '/../vendor/autoload.php';
diff --git a/fusesource/stomp-php/tests/functional/StompASyncTest.php
b/fusesource/stomp-php/tests/functional/StompASyncTest.php
deleted file mode 100644
index 2577554..0000000
--- a/fusesource/stomp-php/tests/functional/StompASyncTest.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-use FuseSource\Stomp\Stomp;
-
-/**
- * Stomp test case.
- *
- * @package Stomp
- * @author Mark R. <[email protected]>
- */
-class StompASyncTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
- $this->Stomp = new Stomp('tcp://localhost:61613');
- $this->Stomp->sync = false;
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp->disconnect();
- $this->Stomp = null;
- parent::tearDown();
- }
-
- /**
- * Tests Stomp->connect(), send(), and subscribe() - out of order. the
messages should be received in FIFO order.
- */
- public function testAsyncSub()
- {
- $this->assertTrue($this->Stomp->connect());
-
- $this->assertTrue($this->Stomp->send('/queue/test', 'test 1'));
- $this->assertTrue($this->Stomp->send('/queue/test', 'test 2'));
- $this->assertTrue($this->Stomp->subscribe('/queue/test'));
-
- $frame = $this->Stomp->readFrame();
- $this->assertEquals($frame->body, 'test 1', 'test 1 was not
received!');
- $this->Stomp->ack($frame);
-
- $frame = $this->Stomp->readFrame();
- $this->assertEquals($frame->body, 'test 2', 'test 2 was not
received!');
- $this->Stomp->ack($frame);
- }
-}
-
diff --git a/fusesource/stomp-php/tests/functional/StompFailoverTest.php
b/fusesource/stomp-php/tests/functional/StompFailoverTest.php
deleted file mode 100644
index f604ade..0000000
--- a/fusesource/stomp-php/tests/functional/StompFailoverTest.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-
-use FuseSource\Stomp\Stomp;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * Stomp test case.
- *
- * @package Stomp
- * @author Michael Caplan <[email protected]>
- * @version $Revision: 35 $
- */
-class StompFailoverTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
-
- $this->Stomp = new
Stomp('failover://(tcp://localhost:61614,tcp://localhost:61613)?randomize=false');
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp->disconnect();
- $this->Stomp = null;
- parent::tearDown();
- }
- /**
- * Tests Stomp->connect()
- */
- public function testFailoverConnect ()
- {
- $this->assertTrue($this->Stomp->connect());
- }
-}
-
diff --git a/fusesource/stomp-php/tests/functional/StompRabbitTest.php
b/fusesource/stomp-php/tests/functional/StompRabbitTest.php
deleted file mode 100644
index 1c44c15..0000000
--- a/fusesource/stomp-php/tests/functional/StompRabbitTest.php
+++ /dev/null
@@ -1,344 +0,0 @@
-<?php
-
-use FuseSource\Stomp\Stomp;
-use FuseSource\Stomp\Message\Map;
-use FuseSource\Stomp\Message\Bytes;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-require_once 'PHPUnit/Framework/TestCase.php';
-/**
- * Stomp test case.
- * @package Stomp
- * @author Michael Caplan <[email protected]>
- * @author Dejan Bosanac <[email protected]>
- * @version $Revision: 40 $
- */
-class StompRabbitTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- private $broker = 'tcp://127.0.0.1:61613';
- private $queue = '/queue/test';
- private $topic = '/topic/test';
- private $login = 'guest';
- private $password = 'guest';
-
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
- $this->Stomp = new Stomp($this->broker);
- $this->Stomp->brokerVendor = 'RMQ';
- $this->Stomp->sync = false;
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp = null;
- parent::tearDown();
- }
-
- /**
- * Tests Stomp->hasFrameToRead()
- *
- */
- public function testHasFrameToRead()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
-
- $this->Stomp->setReadTimeout(5);
-
- $this->assertFalse($this->Stomp->hasFrameToRead(), 'Has frame to read
when non expected');
-
- $this->Stomp->send($this->queue, 'testHasFrameToRead');
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','prefetch-count' => 1 ));
-
- $this->assertTrue($this->Stomp->hasFrameToRead(), 'Did not have frame
to read when expected');
-
- $frame = $this->Stomp->readFrame();
-
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame, 'Frame
expected');
-
- $this->Stomp->ack($frame);
-
- $this->Stomp->disconnect();
-
- $this->Stomp->setReadTimeout(60);
- }
- /**
- * Tests Stomp->ack()
- */
- public function testAck ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
-
- $messages = array();
-
- for ($x = 0; $x < 100; ++$x) {
- $this->Stomp->send($this->queue, $x);
- $messages[$x] = 'sent';
- }
-
- $this->Stomp->disconnect();
-
- for ($y = 0; $y < 100; $y += 10) {
-
- $this->Stomp->connect($this->login, $this->password);
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
- for ($x = $y; $x < $y + 10; ++$x) {
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertArrayHasKey($frame->body, $messages, $frame->body
. ' is not in the list of messages to ack');
- $this->assertEquals('sent', $messages[$frame->body],
$frame->body . ' has been marked acked, but has been received again.');
- $messages[$frame->body] = 'acked';
-
- $this->assertTrue($this->Stomp->ack($frame), "Unable to ack
{$frame->headers['message-id']}");
-
- }
-
- $this->Stomp->disconnect();
-
- }
-
- $un_acked_messages = array();
-
- foreach ($messages as $key => $value) {
- if ($value == 'sent') {
- $un_acked_messages[] = $key;
- }
- }
-
- $this->assertEquals(0, count($un_acked_messages), 'Remaining messages
to ack' . var_export($un_acked_messages, true));
- }
- /**
- * Tests Stomp->abort()
- */
- public function testAbort()
- {
- $this->Stomp->setReadTimeout(1);
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->Stomp->begin("tx1");
- $this->assertTrue($this->Stomp->send($this->queue, 'testSend',
array("transaction" => "tx1")));
- $this->Stomp->abort("tx1");
-
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertFalse($frame);
- $this->Stomp->unsubscribe($this->queue);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp->connect()
- */
- public function testConnect ()
- {
- $this->assertTrue($this->Stomp->connect($this->login,
$this->password));
- $this->assertTrue($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->disconnect()
- */
- public function testDisconnect ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->getSessionId()
- */
- public function testGetSessionId ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->assertNotNull($this->Stomp->getSessionId());
- }
- /**
- * Tests Stomp->isConnected()
- */
- public function testIsConnected ()
- {
- $this->Stomp->connect($this->login, $this->password);
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->readFrame()
- */
- public function testReadFrame ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->Stomp->send($this->queue, 'testReadFrame');
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertEquals('testReadFrame', $frame->body, 'Body of test frame
does not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->send()
- */
- public function testSend ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->assertTrue($this->Stomp->send($this->queue, 'testSend'));
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertEquals('testSend', $frame->body, 'Body of test frame does
not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->subscribe()
- */
- public function testSubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->assertTrue($this->Stomp->subscribe($this->queue));
- $this->Stomp->unsubscribe($this->queue);
- }
-
- /**
- * Tests Stomp message transformation - json map
- */
- public function testJsonMapTransformation()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $body = array("city"=>"Belgrade", "name"=>"Dejan");
- $header = array();
- $header['transformation'] = 'jms-map-json';
- $mapMessage = new Map($body, $header);
- $this->Stomp->send($this->queue, $mapMessage);
-
- $this->Stomp->subscribe($this->queue, array('transformation' =>
'jms-map-json'));
- $msg = $this->Stomp->readFrame();
- $this->assertTrue($msg instanceOf Fusesource\Stomp\Message\Map);
- $this->assertEquals($msg->map, $body);
- $this->Stomp->ack($msg);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp byte messages
- */
- public function testByteMessages()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $body = "test";
- $mapMessage = new Bytes($body);
- $this->Stomp->send($this->queue, $mapMessage);
-
- $this->Stomp->subscribe($this->queue);
- $msg = $this->Stomp->readFrame();
- $this->assertEquals($msg->body, $body);
- $this->Stomp->ack($msg);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp->unsubscribe()
- */
- public function testUnsubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect($this->login, $this->password);
- }
- $this->Stomp->subscribe($this->queue);
- $this->assertTrue($this->Stomp->unsubscribe($this->queue));
- }
-
- public function testDurable() {
- $this->subscribe();
- sleep(2);
- $this->produce();
- sleep(2);
- $this->consume();
- }
-
- protected function subscribe() {
- $consumer = new Stomp($this->broker);
- $consumer->sync = true;
- $consumer->clientId = "test";
- $consumer->connect($this->login, $this->password);
- $consumer->subscribe($this->topic, array('persistent' => 'true'));
- $consumer->unsubscribe($this->topic);
- $consumer->disconnect();
- }
-
- protected function produce() {
- $producer = new Stomp($this->broker);
- $producer->sync = true;
- $producer->connect($this->login, $this->password);
- $producer->send($this->topic, "test message",
array('persistent'=>'true'));
- $producer->disconnect();
- }
-
-
- protected function consume() {
- $consumer2 = new Stomp($this->broker);
- $consumer2->sync = true;
- $consumer2->clientId = "test";
- $consumer2->setReadTimeout(1);
- $consumer2->connect($this->login, $this->password);
- $consumer2->subscribe($this->topic, array('persistent' =>
'true'));
-
- $frame = $consumer2->readFrame();
- $this->assertEquals($frame->body, "test message");
- if ($frame != null) {
- $consumer2->ack($frame);
- }
-
- $consumer2->disconnect();
- }
-}
-
diff --git a/fusesource/stomp-php/tests/functional/StompSslTest.php
b/fusesource/stomp-php/tests/functional/StompSslTest.php
deleted file mode 100644
index 12edce3..0000000
--- a/fusesource/stomp-php/tests/functional/StompSslTest.php
+++ /dev/null
@@ -1,242 +0,0 @@
-<?php
-use FuseSource\Stomp\Stomp;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-/**
- * Stomp test case.
- * @package Stomp
- * @author Michael Caplan <[email protected]>
- * @version $Revision: 38 $
- */
-class StompSslTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- private $broker = 'ssl://localhost:61612';
- private $queue = '/queue/test';
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
- $this->Stomp = new Stomp($this->broker);
- $this->Stomp->sync = false;
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp = null;
- parent::tearDown();
- }
- /**
- * Tests Stomp->abort()
- */
- public function testAbort ()
- {
- // TODO Auto-generated StompTest->testAbort()
- $this->markTestIncomplete("abort test not implemented");
- }
- /**
- * Tests Stomp->hasFrameToRead()
- *
- */
- public function testHasFrameToRead()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
-
- $this->Stomp->setReadTimeout(5);
-
- $this->assertFalse($this->Stomp->hasFrameToRead(), 'Has frame to read
when non expected');
-
- $this->Stomp->send($this->queue, 'testHasFrameToRead');
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
- $this->assertTrue($this->Stomp->hasFrameToRead(), 'Did not have frame
to read when expected');
-
- $frame = $this->Stomp->readFrame();
-
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame, 'Frame
expected');
-
- $this->Stomp->ack($frame);
-
- $this->Stomp->disconnect();
-
- $this->Stomp->setReadTimeout(60);
- }
- /**
- * Tests Stomp->ack()
- */
- public function testAck ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
-
- $messages = array();
-
- for ($x = 0; $x < 100; ++$x) {
- $this->Stomp->send($this->queue, $x);
- $messages[$x] = 'sent';
- }
-
- $this->Stomp->disconnect();
-
- for ($y = 0; $y < 100; $y += 10) {
-
- $this->Stomp->connect();
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
- for ($x = $y; $x < $y + 10; ++$x) {
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertArrayHasKey($frame->body, $messages, $frame->body
. ' is not in the list of messages to ack');
- $this->assertEquals('sent', $messages[$frame->body],
$frame->body . ' has been marked acked, but has been received again.');
- $messages[$frame->body] = 'acked';
-
- $this->assertTrue($this->Stomp->ack($frame), "Unable to ack
{$frame->headers['message-id']}");
-
- }
-
- $this->Stomp->disconnect();
-
- }
- }
- /**
- * Tests Stomp->begin()
- */
- public function testBegin ()
- {
- // TODO Auto-generated StompTest->testBegin()
- $this->markTestIncomplete("begin test not implemented");
- $this->Stomp->begin(/* parameters */);
- }
- /**
- * Tests Stomp->commit()
- */
- public function testCommit ()
- {
- // TODO Auto-generated StompTest->testCommit()
- $this->markTestIncomplete("commit test not implemented");
- $this->Stomp->commit(/* parameters */);
- }
- /**
- * Tests Stomp->connect()
- */
- public function testConnect ()
- {
- $this->assertTrue($this->Stomp->connect());
- $this->assertTrue($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->disconnect()
- */
- public function testDisconnect ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->getSessionId()
- */
- public function testGetSessionId ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertNotNull($this->Stomp->getSessionId());
- }
- /**
- * Tests Stomp->isConnected()
- */
- public function testIsConnected ()
- {
- $this->Stomp->connect();
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->readFrame()
- */
- public function testReadFrame ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->Stomp->send($this->queue, 'testReadFrame');
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertEquals('testReadFrame', $frame->body, 'Body of test frame
does not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->send()
- */
- public function testSend ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->send($this->queue, 'testSend'));
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertEquals('testSend', $frame->body, 'Body of test frame does
not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->subscribe()
- */
- public function testSubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->subscribe($this->queue));
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->unsubscribe()
- */
- public function testUnsubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->Stomp->subscribe($this->queue);
- $this->assertTrue($this->Stomp->unsubscribe($this->queue));
- }
-}
-
diff --git a/fusesource/stomp-php/tests/functional/StompSyncTest.php
b/fusesource/stomp-php/tests/functional/StompSyncTest.php
deleted file mode 100644
index de49ae7..0000000
--- a/fusesource/stomp-php/tests/functional/StompSyncTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-use FuseSource\Stomp\Stomp;
-
-/**
- * Stomp test case.
- *
- * @package Stomp
- * @author Mark R. <[email protected]>
- */
-class StompSyncTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
- $this->Stomp = new Stomp('tcp://localhost:61613');
- $this->Stomp->sync = true;
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp->disconnect();
- $this->Stomp = null;
- parent::tearDown();
- }
-
- /**
- * Tests Stomp->connect(), send() and subscribe() in order.
- */
- public function testSyncSub()
- {
- $this->assertTrue($this->Stomp->connect());
- $this->assertTrue($this->Stomp->subscribe('/queue/test'));
- $this->assertTrue($this->Stomp->send('/queue/test', 'test 1'));
- $this->assertTrue($this->Stomp->send('/queue/test', 'test 2'));
-
-
- $this->Stomp->setReadTimeout(5);
-
- $frame = $this->Stomp->readFrame();
- $this->assertEquals('test 1', $frame->body, 'test 1 not received!');
- $this->Stomp->ack($frame);
-
- $frame = $this->Stomp->readFrame();
- $this->assertEquals('test 2', $frame->body, 'test 2 not received!');
- $this->Stomp->ack($frame);
- }
-}
-
diff --git a/fusesource/stomp-php/tests/functional/StompTest.php
b/fusesource/stomp-php/tests/functional/StompTest.php
deleted file mode 100644
index 6746500..0000000
--- a/fusesource/stomp-php/tests/functional/StompTest.php
+++ /dev/null
@@ -1,339 +0,0 @@
-<?php
-
-use FuseSource\Stomp\Stomp;
-use FuseSource\Stomp\Message\Map;
-use FuseSource\Stomp\Message\Bytes;
-/**
- *
- * Copyright 2005-2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/* vim: set expandtab tabstop=3 shiftwidth=3: */
-
-require_once 'PHPUnit/Framework/TestCase.php';
-/**
- * Stomp test case.
- * @package Stomp
- * @author Michael Caplan <[email protected]>
- * @author Dejan Bosanac <[email protected]>
- * @version $Revision: 40 $
- */
-class StompTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $Stomp;
- private $broker = 'tcp://127.0.0.1:61613';
- private $queue = '/queue/test';
- private $topic = '/topic/test';
- /**
- * Prepares the environment before running a test.
- */
- protected function setUp ()
- {
- parent::setUp();
-
- $this->Stomp = new Stomp($this->broker);
- $this->Stomp->sync = false;
- }
- /**
- * Cleans up the environment after running a test.
- */
- protected function tearDown ()
- {
- $this->Stomp = null;
- parent::tearDown();
- }
-
- /**
- * Tests Stomp->hasFrameToRead()
- *
- */
- public function testHasFrameToRead()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
-
- $this->Stomp->setReadTimeout(5);
-
- $this->assertFalse($this->Stomp->hasFrameToRead(), 'Has frame to read
when non expected');
-
- $this->Stomp->send($this->queue, 'testHasFrameToRead');
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
- $this->assertTrue($this->Stomp->hasFrameToRead(), 'Did not have frame
to read when expected');
-
- $frame = $this->Stomp->readFrame();
-
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame, 'Frame
expected');
-
- $this->Stomp->ack($frame);
-
- $this->Stomp->disconnect();
-
- $this->Stomp->setReadTimeout(60);
- }
- /**
- * Tests Stomp->ack()
- */
- public function testAck ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
-
- $messages = array();
-
- for ($x = 0; $x < 100; ++$x) {
- $this->Stomp->send($this->queue, $x);
- $messages[$x] = 'sent';
- }
-
- $this->Stomp->disconnect();
-
- for ($y = 0; $y < 100; $y += 10) {
-
- $this->Stomp->connect();
-
- $this->Stomp->subscribe($this->queue, array('ack' =>
'client','activemq.prefetchSize' => 1 ));
-
- for ($x = $y; $x < $y + 10; ++$x) {
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertArrayHasKey($frame->body, $messages, $frame->body
. ' is not in the list of messages to ack');
- $this->assertEquals('sent', $messages[$frame->body],
$frame->body . ' has been marked acked, but has been received again.');
- $messages[$frame->body] = 'acked';
-
- $this->assertTrue($this->Stomp->ack($frame), "Unable to ack
{$frame->headers['message-id']}");
-
- }
-
- $this->Stomp->disconnect();
-
- }
-
- $un_acked_messages = array();
-
- foreach ($messages as $key => $value) {
- if ($value == 'sent') {
- $un_acked_messages[] = $key;
- }
- }
-
- $this->assertEquals(0, count($un_acked_messages), 'Remaining messages
to ack' . var_export($un_acked_messages, true));
- }
- /**
- * Tests Stomp->abort()
- */
- public function testAbort()
- {
- $this->Stomp->setReadTimeout(1);
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->Stomp->begin("tx1");
- $this->assertTrue($this->Stomp->send($this->queue, 'testSend',
array("transaction" => "tx1")));
- $this->Stomp->abort("tx1");
-
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertFalse($frame);
- $this->Stomp->unsubscribe($this->queue);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp->connect()
- */
- public function testConnect ()
- {
- $this->assertTrue($this->Stomp->connect());
- $this->assertTrue($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->disconnect()
- */
- public function testDisconnect ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->getSessionId()
- */
- public function testGetSessionId ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertNotNull($this->Stomp->getSessionId());
- }
- /**
- * Tests Stomp->isConnected()
- */
- public function testIsConnected ()
- {
- $this->Stomp->connect();
- $this->assertTrue($this->Stomp->isConnected());
- $this->Stomp->disconnect();
- $this->assertFalse($this->Stomp->isConnected());
- }
- /**
- * Tests Stomp->readFrame()
- */
- public function testReadFrame ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->Stomp->send($this->queue, 'testReadFrame');
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertEquals('testReadFrame', $frame->body, 'Body of test frame
does not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->send()
- */
- public function testSend ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->send($this->queue, 'testSend'));
- $this->Stomp->subscribe($this->queue);
- $frame = $this->Stomp->readFrame();
- $this->assertTrue($frame instanceof Fusesource\Stomp\Frame);
- $this->assertEquals('testSend', $frame->body, 'Body of test frame does
not match sent message');
- $this->Stomp->ack($frame);
- $this->Stomp->unsubscribe($this->queue);
- }
- /**
- * Tests Stomp->subscribe()
- */
- public function testSubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->assertTrue($this->Stomp->subscribe($this->queue));
- $this->Stomp->unsubscribe($this->queue);
- }
-
- /**
- * Tests Stomp message transformation - json map
- */
- public function testJsonMapTransformation()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $body = array("city"=>"Belgrade", "name"=>"Dejan");
- $header = array();
- $header['transformation'] = 'jms-map-json';
- $mapMessage = new Map($body, $header);
- $this->Stomp->send($this->queue, $mapMessage);
-
- $this->Stomp->subscribe($this->queue, array('transformation' =>
'jms-map-json'));
- $msg = $this->Stomp->readFrame();
- $this->assertTrue($msg instanceOf Fusesource\Stomp\Message\Map);
- $this->assertEquals($msg->map, $body);
- $this->Stomp->ack($msg);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp byte messages
- */
- public function testByteMessages()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $body = "test";
- $mapMessage = new Bytes($body);
- $this->Stomp->send($this->queue, $mapMessage);
-
- $this->Stomp->subscribe($this->queue);
- $msg = $this->Stomp->readFrame();
- $this->assertEquals($msg->body, $body);
- $this->Stomp->ack($msg);
- $this->Stomp->disconnect();
- }
-
- /**
- * Tests Stomp->unsubscribe()
- */
- public function testUnsubscribe ()
- {
- if (! $this->Stomp->isConnected()) {
- $this->Stomp->connect();
- }
- $this->Stomp->subscribe($this->queue);
- $this->assertTrue($this->Stomp->unsubscribe($this->queue));
- }
-
- public function testDurable() {
- $this->subscribe();
- sleep(2);
- $this->produce();
- sleep(2);
- $this->consume();
- }
-
- protected function produce() {
- $producer = new Stomp($this->broker);
- $producer->sync = false;
- $producer->connect("system", "manager");
- $producer->send($this->topic, "test message",
array('persistent'=>'true'));
- $producer->disconnect();
- }
-
- protected function subscribe() {
- $consumer = new Stomp($this->broker);
- $consumer->sync = false;
- $consumer->clientId = "test";
- $consumer->connect("system", "manager");
- $consumer->subscribe($this->topic);
- $consumer->unsubscribe($this->topic);
- $consumer->disconnect();
- }
-
- protected function consume() {
- $consumer2 = new Stomp($this->broker);
- $consumer2->sync = false;
- $consumer2->clientId = "test";
- $consumer2->setReadTimeout(1);
- $consumer2->connect("system", "manager");
- $consumer2->subscribe($this->topic);
-
- $frame = $consumer2->readFrame();
- $this->assertEquals($frame->body, "test message");
- if ($frame != null) {
- $consumer2->ack($frame);
- }
-
- $consumer2->disconnect();
- }
-}
-
diff --git a/fusesource/stomp-php/tests/stubbed/StompUnitTest.php
b/fusesource/stomp-php/tests/stubbed/StompUnitTest.php
deleted file mode 100644
index 11325cb..0000000
--- a/fusesource/stomp-php/tests/stubbed/StompUnitTest.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-namespace FuseSource\Stomp;
-
-use PHPUnit_Framework_TestCase;
-
-// Prepare mocking function calls
-require_once(__DIR__ . '/fusesource_stream_function_stubs.php');
-
-class StompUnitTest extends PHPUnit_Framework_TestCase
-{
- /**
- * @var Stomp
- */
- private $sut;
-
- protected function setUp()
- {
- $this->sut = new Stomp('tcp://localhost:61613');
- }
-
- public function testReadFrameWithTrailingLineFeed()
- {
- // Mock functions return values
- global $fusesourceStreamFunctionStubsBuffer;
- $fusesourceStreamFunctionStubsBuffer =array(
- "MESSAGE\n\nbody\x00\n",
- "MESSAGE\n\nbody\x00",
- );
-
- $this->sut->readFrame();
- $frame = $this->sut->readFrame();
- $this->assertSame(
- 'MESSAGE',
- $frame->command
- );
- }
-
- public function testReadFrameWithLeadingLineFeed()
- {
- $this->sut = new Stomp('tcp://localhost:61613');
-
- // Mock functions return values
- global $fusesourceStreamFunctionStubsBuffer;
- $fusesourceStreamFunctionStubsBuffer =array(
- "MESSAGE\n\nbody\x00",
- "\nMESSAGE\n\nbody\x00",
- );
-
- $this->sut->readFrame();
- $frame = $this->sut->readFrame();
- $this->assertSame(
- 'MESSAGE',
- $frame->command
- );
- }
-}
diff --git
a/fusesource/stomp-php/tests/stubbed/fusesource_stream_function_stubs.php
b/fusesource/stomp-php/tests/stubbed/fusesource_stream_function_stubs.php
deleted file mode 100644
index e2b56e5..0000000
--- a/fusesource/stomp-php/tests/stubbed/fusesource_stream_function_stubs.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-namespace FuseSource\Stomp;
-
-function stream_select()
-{
- global $fusesourceStreamFunctionStubsBuffer;
- if (count($fusesourceStreamFunctionStubsBuffer) === 0) {
- return false;
- }
- return strlen($fusesourceStreamFunctionStubsBuffer[0]);
-}
-
-function fread($socket, $count)
-{
- global $fusesourceStreamFunctionStubsBuffer;
- return array_shift($fusesourceStreamFunctionStubsBuffer);
-}
-
-function feof()
-{
- global $fusesourceStreamFunctionStubsBuffer;
- return count($fusesourceStreamFunctionStubsBuffer)===0;
-}
\ No newline at end of file
diff --git a/fusesource/stomp-php/travisci/bin/ci/install_dependencies.sh
b/fusesource/stomp-php/travisci/bin/ci/install_dependencies.sh
deleted file mode 100755
index fb4ebe1..0000000
--- a/fusesource/stomp-php/travisci/bin/ci/install_dependencies.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-AMQ_VERSION="5.7.0"
-wget
http://mirror.synyx.de/apache/activemq/apache-activemq/${AMQ_VERSION}/apache-activemq-${AMQ_VERSION}-bin.tar.gz
-tar -xzf apache-activemq-${AMQ_VERSION}-bin.tar.gz
-
-cp travisci/conf/amq/activemq.xml
apache-activemq-${AMQ_VERSION}/conf/activemq.xml
-
-apache-activemq-${AMQ_VERSION}/bin/linux-x86-32/activemq start
-
diff --git a/fusesource/stomp-php/travisci/conf/amq/activemq.xml
b/fusesource/stomp-php/travisci/conf/amq/activemq.xml
deleted file mode 100644
index 5ea7570..0000000
--- a/fusesource/stomp-php/travisci/conf/amq/activemq.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- START SNIPPET: example -->
-<beans
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:amq="http://activemq.apache.org/schema/core"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
-
- <!-- Allows us to use system properties as variables in this configuration
file -->
- <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="locations">
- <value>file:${activemq.conf}/credentials.properties</value>
- </property>
- </bean>
-
- <!--
- The <broker> element is used to configure the ActiveMQ broker.
- -->
- <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}">
-
- <!--
- For better performances use VM cursor and small memory limit.
- For more information, see:
-
- http://activemq.apache.org/message-cursors.html
-
- Also, if your producer is "hanging", it's probably due to producer
flow control.
- For more information, see:
- http://activemq.apache.org/producer-flow-control.html
- -->
-
- <destinationPolicy>
- <policyMap>
- <policyEntries>
- <policyEntry topic=">" producerFlowControl="true"
memoryLimit="1mb">
- <pendingSubscriberPolicy>
- <vmCursor />
- </pendingSubscriberPolicy>
- </policyEntry>
- <policyEntry queue=">" producerFlowControl="true"
memoryLimit="1mb">
- <!-- Use VM cursor for better latency
- For more information, see:
-
- http://activemq.apache.org/message-cursors.html
-
- <pendingQueuePolicy>
- <vmQueueCursor/>
- </pendingQueuePolicy>
- -->
- </policyEntry>
- </policyEntries>
- </policyMap>
- </destinationPolicy>
-
-
- <!--
- The managementContext is used to configure how ActiveMQ is exposed
in
- JMX. By default, ActiveMQ uses the MBean server that is started by
- the JVM. For more information, see:
-
- http://activemq.apache.org/jmx.html
- -->
- <managementContext>
- <managementContext createConnector="false"/>
- </managementContext>
-
- <!--
- Configure message persistence for the broker. The default
persistence
- mechanism is the KahaDB store (identified by the kahaDB tag).
- For more information, see:
-
- http://activemq.apache.org/persistence.html
- -->
- <persistenceAdapter>
- <kahaDB directory="${activemq.data}/kahadb"/>
- </persistenceAdapter>
-
-
- <!--
- The systemUsage controls the maximum amount of space the broker
will
- use before slowing down producers. For more information, see:
- http://activemq.apache.org/producer-flow-control.html
- If using ActiveMQ embedded - the following limits could safely be
used:
-
- <systemUsage>
- <systemUsage>
- <memoryUsage>
- <memoryUsage limit="20 mb"/>
- </memoryUsage>
- <storeUsage>
- <storeUsage limit="1 gb"/>
- </storeUsage>
- <tempUsage>
- <tempUsage limit="100 mb"/>
- </tempUsage>
- </systemUsage>
- </systemUsage>
- -->
- <systemUsage>
- <systemUsage>
- <memoryUsage>
- <memoryUsage limit="64 mb"/>
- </memoryUsage>
- <storeUsage>
- <storeUsage limit="100 gb"/>
- </storeUsage>
- <tempUsage>
- <tempUsage limit="50 gb"/>
- </tempUsage>
- </systemUsage>
- </systemUsage>
-
- <!--
- The transport connectors expose ActiveMQ over a given protocol to
- clients and other brokers. For more information, see:
-
- http://activemq.apache.org/configuring-transports.html
- -->
- <transportConnectors>
- <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
- <transportConnector name="stomp"
uri="stomp://0.0.0.0:61613?transport.closeAsync=false"/>
- <transportConnector name="stomp+ssl"
uri="stomp+ssl://0.0.0.0:61612?transport.closeAsync=false"/>
- </transportConnectors>
-
- </broker>
-
- <!--
- Enable web consoles, REST and Ajax APIs and demos
-
- Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details
- -->
- <import resource="jetty.xml"/>
-
-</beans>
-<!-- END SNIPPET: example -->
--
To view, visit https://gerrit.wikimedia.org/r/332641
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I184b3a26581bc028a8d70752ae2d225d1abc50a2
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/SmashPig/vendor
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits