activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject [06/18] Porting apollo examples structure to ActiveMQ 5.9.
Date Thu, 10 Oct 2013 14:40:29 GMT
http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/StompExample.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/StompExample.java b/assembly/src/release/examples/openwire/swissarmy/src/StompExample.java
new file mode 100644
index 0000000..0f18210
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/StompExample.java
@@ -0,0 +1,59 @@
+/**
+ * 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.
+ */
+import org.apache.activemq.transport.stomp.Stomp;
+import org.apache.activemq.transport.stomp.StompConnection;
+import org.apache.activemq.transport.stomp.StompFrame;
+import org.apache.activemq.transport.stomp.Stomp.Headers.Subscribe;
+
+/**
+ * 
+ * This example demonstrates Stomp Java API
+ * 
+ * 
+ *
+ */
+public class StompExample {
+
+	public static void main(String args[]) throws Exception {
+		StompConnection connection = new StompConnection();
+		connection.open("localhost", 61616);
+		
+		connection.connect("system", "manager");
+		
+		connection.begin("tx1");
+		connection.send("/queue/test", "message1");
+		connection.send("/queue/test", "message2");
+		connection.commit("tx1");
+		
+		connection.subscribe("/queue/test", Subscribe.AckModeValues.CLIENT);
+		
+		connection.begin("tx2");
+		
+		StompFrame message = connection.receive();
+		System.out.println(message.getBody());
+		connection.ack(message, "tx2");
+		
+		message = connection.receive();
+		System.out.println(message.getBody());
+		connection.ack(message, "tx2");
+		
+		connection.commit("tx2");
+		
+		connection.disconnect();
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/TopicListener.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/TopicListener.java b/assembly/src/release/examples/openwire/swissarmy/src/TopicListener.java
new file mode 100644
index 0000000..dbecafd
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/TopicListener.java
@@ -0,0 +1,118 @@
+/**
+ * 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.
+ */
+import java.util.Arrays;
+
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+/**
+ * Use in conjunction with TopicPublisher to test the performance of ActiveMQ
+ * Topics.
+ */
+public class TopicListener implements MessageListener {
+
+    private Connection connection;
+    private MessageProducer producer;
+    private Session session;
+    private int count;
+    private long start;
+    private Topic topic;
+    private Topic control;
+
+    private String url = "tcp://localhost:61616";
+
+    public static void main(String[] argv) throws Exception {
+        TopicListener l = new TopicListener();
+        String[] unknown = CommandLineSupport.setOptions(l, argv);
+        if (unknown.length > 0) {
+            System.out.println("Unknown options: " + Arrays.toString(unknown));
+            System.exit(-1);
+        }
+        l.run();
+    }
+
+    public void run() throws JMSException {
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
+        connection = factory.createConnection();
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        topic = session.createTopic("topictest.messages");
+        control = session.createTopic("topictest.control");
+
+        MessageConsumer consumer = session.createConsumer(topic);
+        consumer.setMessageListener(this);
+
+        connection.start();
+
+        producer = session.createProducer(control);
+        System.out.println("Waiting for messages...");
+    }
+
+    private static boolean checkText(Message m, String s) {
+        try {
+            return m instanceof TextMessage && ((TextMessage)m).getText().equals(s);
+        } catch (JMSException e) {
+            e.printStackTrace(System.out);
+            return false;
+        }
+    }
+
+    public void onMessage(Message message) {
+        if (checkText(message, "SHUTDOWN")) {
+
+            try {
+                connection.close();
+            } catch (Exception e) {
+                e.printStackTrace(System.out);
+            }
+
+        } else if (checkText(message, "REPORT")) {
+            // send a report:
+            try {
+                long time = System.currentTimeMillis() - start;
+                String msg = "Received " + count + " in " + time + "ms";
+                producer.send(session.createTextMessage(msg));
+            } catch (Exception e) {
+                e.printStackTrace(System.out);
+            }
+            count = 0;
+
+        } else {
+
+            if (count == 0) {
+                start = System.currentTimeMillis();
+            }
+
+            if (++count % 1000 == 0) {
+                System.out.println("Received " + count + " messages.");
+            }
+        }
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/TopicPublisher.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/TopicPublisher.java b/assembly/src/release/examples/openwire/swissarmy/src/TopicPublisher.java
new file mode 100644
index 0000000..dd99846
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/TopicPublisher.java
@@ -0,0 +1,205 @@
+/**
+ * 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.
+ */
+import java.util.Arrays;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+/**
+ * Use in conjunction with TopicListener to test the performance of ActiveMQ
+ * Topics.
+ */
+public class TopicPublisher implements MessageListener {
+
+    private static final char[] DATA = "abcdefghijklmnopqrstuvwxyz".toCharArray();
+
+    private final Object mutex = new Object();
+    private Connection connection;
+    private Session session;
+    private MessageProducer publisher;
+    private Topic topic;
+    private Topic control;
+
+    private String url = "tcp://localhost:61616";
+    private int size = 256;
+    private int subscribers = 1;
+    private int remaining;
+    private int messages = 10000;
+    private long delay;
+    private int batch = 2000;
+
+    private byte[] payload;
+
+    public static void main(String[] argv) throws Exception {
+        TopicPublisher p = new TopicPublisher();
+        String[] unknown = CommandLineSupport.setOptions(p, argv);
+        if (unknown.length > 0) {
+            System.out.println("Unknown options: " + Arrays.toString(unknown));
+            System.exit(-1);
+        }
+        p.run();
+    }
+
+    private void run() throws Exception {
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(url);
+        connection = factory.createConnection();
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        topic = session.createTopic("topictest.messages");
+        control = session.createTopic("topictest.control");
+
+        publisher = session.createProducer(topic);
+        publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+        payload = new byte[size];
+        for (int i = 0; i < size; i++) {
+            payload[i] = (byte)DATA[i % DATA.length];
+        }
+
+        session.createConsumer(control).setMessageListener(this);
+        connection.start();
+
+        long[] times = new long[batch];
+        for (int i = 0; i < batch; i++) {
+            if (i > 0) {
+                Thread.sleep(delay * 1000);
+            }
+            times[i] = batch(messages);
+            System.out.println("Batch " + (i + 1) + " of " + batch + " completed in " + times[i] + " ms.");
+        }
+
+        long min = min(times);
+        long max = max(times);
+        System.out.println("min: " + min + ", max: " + max + " avg: " + avg(times, min, max));
+
+        // request shutdown
+        publisher.send(session.createTextMessage("SHUTDOWN"));
+
+        connection.stop();
+        connection.close();
+    }
+
+    private long batch(int msgCount) throws Exception {
+        long start = System.currentTimeMillis();
+        remaining = subscribers;
+        publish();
+        waitForCompletion();
+        return System.currentTimeMillis() - start;
+    }
+
+    private void publish() throws Exception {
+
+        // send events
+        BytesMessage msg = session.createBytesMessage();
+        msg.writeBytes(payload);
+        for (int i = 0; i < messages; i++) {
+            publisher.send(msg);
+            if ((i + 1) % 1000 == 0) {
+                System.out.println("Sent " + (i + 1) + " messages");
+            }
+        }
+
+        // request report
+        publisher.send(session.createTextMessage("REPORT"));
+    }
+
+    private void waitForCompletion() throws Exception {
+        System.out.println("Waiting for completion...");
+        synchronized (mutex) {
+            while (remaining > 0) {
+                mutex.wait();
+            }
+        }
+    }
+
+    public void onMessage(Message message) {
+        synchronized (mutex) {
+            System.out.println("Received report " + getReport(message) + " " + --remaining + " remaining");
+            if (remaining == 0) {
+                mutex.notify();
+            }
+        }
+    }
+
+    Object getReport(Message m) {
+        try {
+            return ((TextMessage)m).getText();
+        } catch (JMSException e) {
+            e.printStackTrace(System.out);
+            return e.toString();
+        }
+    }
+
+    static long min(long[] times) {
+        long min = times.length > 0 ? times[0] : 0;
+        for (int i = 0; i < times.length; i++) {
+            min = Math.min(min, times[i]);
+        }
+        return min;
+    }
+
+    static long max(long[] times) {
+        long max = times.length > 0 ? times[0] : 0;
+        for (int i = 0; i < times.length; i++) {
+            max = Math.max(max, times[i]);
+        }
+        return max;
+    }
+
+    static long avg(long[] times, long min, long max) {
+        long sum = 0;
+        for (int i = 0; i < times.length; i++) {
+            sum += times[i];
+        }
+        sum -= min;
+        sum -= max;
+        return sum / times.length - 2;
+    }
+
+    public void setBatch(int batch) {
+        this.batch = batch;
+    }
+
+    public void setDelay(long delay) {
+        this.delay = delay;
+    }
+
+    public void setMessages(int messages) {
+        this.messages = messages;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public void setSubscribers(int subscribers) {
+        this.subscribers = subscribers;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/jndi.properties
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/jndi.properties b/assembly/src/release/examples/openwire/swissarmy/src/jndi.properties
new file mode 100644
index 0000000..19dad58
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/jndi.properties
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+topic.logTopic=logTopic
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/openwire/swissarmy/src/log4j-jms.properties
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/openwire/swissarmy/src/log4j-jms.properties b/assembly/src/release/examples/openwire/swissarmy/src/log4j-jms.properties
new file mode 100644
index 0000000..e28d6d6
--- /dev/null
+++ b/assembly/src/release/examples/openwire/swissarmy/src/log4j-jms.properties
@@ -0,0 +1,31 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+log4j.rootLogger=INFO, stdout, jms
+
+## Be sure that ActiveMQ messages are not logged to 'jms' appender
+log4j.logger.org.apache.activemq=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %m%n
+
+## Configure 'jms' appender. You'll also need jndi.properties file in order to make it work
+log4j.appender.jms=org.apache.log4j.net.JMSAppender
+log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+log4j.appender.jms.ProviderURL=tcp://localhost:61616
+log4j.appender.jms.TopicBindingName=logTopic
+log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh b/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
new file mode 100755
index 0000000..c226b4a
--- /dev/null
+++ b/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
@@ -0,0 +1,49 @@
+# ------------------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------------------
+
+# ==================================================================
+# Helper script to run the IBM JMS performance harness against
+# the ActiveMQ message broker.
+#
+# Sample Usage: 
+#   ./perfharness-activemq.sh -d dynamicQueues/FOO -tc jms.r11.PutGet -nt 6
+#
+# It assumes that the apache-activemq-${project.version}.jar and 
+# perfharness.jar files are in the current directory.  If they are not,
+# set the ACTIVEMQ_HOME and PERFHARNESS_HOME env variable to the correct location.
+#
+# You can download the perfharness.jar file from:
+# http://www.alphaworks.ibm.com/tech/perfharness
+#
+# By Default the test connects the the vm://localhost broker.
+# To change that, use set the BROKER_URL to the broker url you want to use.
+#
+# ==================================================================
+
+if [ -z "$PERFHARNESS_HOME" ] ; then
+   PERFHARNESS_HOME=.
+fi
+
+if [ -z "$ACTIVEMQ_HOME" ] ; then
+   ACTIVEMQ_HOME=../..
+fi
+
+if [ -z "$BROKER_URL" ] ; then
+   BROKER_URL='vm://(broker://()/localhost?useJmx=false)/localhost'
+fi
+
+java ${JAVA_OPTIONS} -cp ${ACTIVEMQ_HOME}/apache-activemq-${project.version}.jar:${PERFHARNESS_HOME}/perfharness.jar JMSPerfHarness -pc JNDI -ii org.apache.activemq.jndi.ActiveMQInitialContextFactory -iu $BROKER_URL -cf ConnectionFactory -d dynamic$DESTINATION $@

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/cpp/Listener.cpp
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/cpp/Listener.cpp b/assembly/src/release/examples/stomp/cpp/Listener.cpp
new file mode 100644
index 0000000..c38e9e2
--- /dev/null
+++ b/assembly/src/release/examples/stomp/cpp/Listener.cpp
@@ -0,0 +1,126 @@
+/*
+ * 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.
+ */
+
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/core/ActiveMQConnection.h>
+#include <activemq/library/ActiveMQCPP.h>
+#include <decaf/lang/Integer.h>
+#include <decaf/lang/System.h>
+#include <activemq/util/Config.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/Destination.h>
+#include <cms/MessageProducer.h>
+#include <cms/TextMessage.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+
+using namespace activemq;
+using namespace activemq::core;
+using namespace decaf::lang;
+using namespace cms;
+using namespace std;
+
+////////////////////////////////////////////////////////////////////////////////
+std::string getEnv(const std::string& key, const std::string& defaultValue) {
+
+    try{
+        return System::getenv(key);
+    } catch(...) {
+    }
+
+    return defaultValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string getArg(char* argv[], int argc, int index, const std::string& defaultValue) {
+
+    if( index < argc ) {
+        return argv[index];
+    }
+
+    return defaultValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int main(int argc AMQCPP_UNUSED, char* argv[] AMQCPP_UNUSED) {
+
+    activemq::library::ActiveMQCPP::initializeLibrary();
+
+    std::cout << "=====================================================\n";
+    std::cout << "Starting the Listener example:" << std::endl;
+    std::cout << "-----------------------------------------------------\n";
+
+    std::string user = getEnv("ACTIVEMQ_USER", "admin");
+    std::string password = getEnv("ACTIVEMQ_PASSWORD", "password");
+    std::string host = getEnv("ACTIVEMQ_HOST", "localhost");
+    int port = Integer::parseInt(getEnv("ACTIVEMQ_PORT", "61613"));
+    std::string destination = getArg(argv, argc, 1, "event");
+
+    {
+        ActiveMQConnectionFactory factory;
+        factory.setBrokerURI(std::string("tcp://") + host + ":" + Integer::toString(port) + "?wireFormat=stomp");
+
+        std::auto_ptr<Connection> connection(factory.createConnection(user, password));
+
+        std::auto_ptr<Session> session(connection->createSession());
+        std::auto_ptr<Destination> dest(session->createTopic(destination));
+        std::auto_ptr<MessageConsumer> consumer(session->createConsumer(dest.get()));
+
+        connection->start();
+
+        long long start = System::currentTimeMillis();
+        long long count = 0;
+
+        std::cout << "Waiting for messages..." << std::endl;
+        while(true) {
+
+            std::auto_ptr<Message> message(consumer->receive());
+
+            const TextMessage* txtMsg = dynamic_cast<const TextMessage*>(message.get());
+
+            if( txtMsg != NULL ) {
+                std::string body = txtMsg->getText();
+                if( body == "SHUTDOWN" ) {
+                    long long diff = System::currentTimeMillis() - start;
+                    cout << "Received " << count << " in " << (double)diff/1000.0 << " seconds" << std::endl;
+                    break;
+                } else {
+                    if( count == 0 ) {
+                        start = System::currentTimeMillis();
+                    }
+                    count++;
+                    if( count % 1000 == 0 ) {
+                        std::cout << "Received " << count << " messages." << std::endl;
+                    }
+                }
+
+            } else {
+                std::cout << "Unexpected message type." << std::endl;
+            }
+        }
+
+        connection->close();
+    }
+
+    std::cout << "-----------------------------------------------------\n";
+    std::cout << "Finished with the example." << std::endl;
+    std::cout << "=====================================================\n";
+
+    activemq::library::ActiveMQCPP::shutdownLibrary();
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/cpp/Publisher.cpp
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/cpp/Publisher.cpp b/assembly/src/release/examples/stomp/cpp/Publisher.cpp
new file mode 100644
index 0000000..fc0ab6c
--- /dev/null
+++ b/assembly/src/release/examples/stomp/cpp/Publisher.cpp
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+#include <activemq/util/Config.h>
+
+#include <decaf/lang/System.h>
+#include <decaf/lang/Runnable.h>
+#include <decaf/lang/Integer.h>
+#include <activemq/core/ActiveMQConnectionFactory.h>
+#include <activemq/library/ActiveMQCPP.h>
+#include <cms/Connection.h>
+#include <cms/Session.h>
+#include <cms/Destination.h>
+#include <cms/MessageProducer.h>
+#include <cms/TextMessage.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <memory>
+
+using namespace cms;
+using namespace activemq;
+using namespace activemq::core;
+using namespace decaf;
+using namespace decaf::lang;
+
+////////////////////////////////////////////////////////////////////////////////
+std::string getEnv(const std::string& key, const std::string& defaultValue) {
+
+    try{
+        return System::getenv(key);
+    } catch(...) {
+    }
+
+    return defaultValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+std::string getArg(char* argv[], int argc, int index, const std::string& defaultValue) {
+
+    if( index < argc ) {
+        return argv[index];
+    }
+
+    return defaultValue;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+int main(int argc, char* argv[]) {
+
+    activemq::library::ActiveMQCPP::initializeLibrary();
+
+    std::cout << "=====================================================\n";
+    std::cout << "Starting the Publisher example:" << std::endl;
+    std::cout << "-----------------------------------------------------\n";
+
+    std::string user = getEnv("ACTIVEMQ_USER", "admin");
+    std::string password = getEnv("ACTIVEMQ_PASSWORD", "password");
+    std::string host = getEnv("ACTIVEMQ_HOST", "localhost");
+    int port = Integer::parseInt(getEnv("ACTIVEMQ_PORT", "61613"));
+    std::string destination = getArg(argv, argc, 1, "event");
+
+    int messages = 10000;
+    int size = 256;
+
+    std::string DATA = "abcdefghijklmnopqrstuvwxyz";
+    std::string body = "";
+    for( int i=0; i < size; i ++) {
+        body += DATA.at(i%DATA.length());
+    }
+
+    {
+        ActiveMQConnectionFactory factory;
+        factory.setBrokerURI(std::string("tcp://") + host + ":" + Integer::toString(port) + "?wireFormat=stomp");
+
+        std::auto_ptr<TextMessage> message;
+        std::auto_ptr<Connection> connection(factory.createConnection(user, password));
+
+        connection->start();
+
+        std::auto_ptr<Session> session(connection->createSession());
+        std::auto_ptr<Destination> dest(session->createTopic(destination));
+        std::auto_ptr<MessageProducer> producer(session->createProducer(dest.get()));
+
+        producer->setDeliveryMode(DeliveryMode::NON_PERSISTENT);
+
+        for( int i=1; i <= messages; i ++) {
+            message.reset(session->createTextMessage(body));
+            producer->send(message.get());
+            if( (i % 1000) == 0) {
+                std::cout << "Sent " << i << " messages" << std::endl;;
+            }
+        }
+
+        message.reset(session->createTextMessage("SHUTDOWN"));
+        producer->send(message.get());
+
+        connection->close();
+    }
+
+    std::cout << "-----------------------------------------------------\n";
+    std::cout << "Finished with the example." << std::endl;
+    std::cout << "=====================================================\n";
+
+    activemq::library::ActiveMQCPP::shutdownLibrary();
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/cpp/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/cpp/readme.md b/assembly/src/release/examples/stomp/cpp/readme.md
new file mode 100644
index 0000000..4aa397c
--- /dev/null
+++ b/assembly/src/release/examples/stomp/cpp/readme.md
@@ -0,0 +1,44 @@
+Prereqs
+=======
+
+These examples use the [ActiveMQ-CPP](http://activemq.apache.org/cms) C++ library,
+but unfortunately they don't work with the latest 3.2.4 release, you have to either
+wait for a subsequent release of do a source build of the project trunk.  Until then,
+you will need to 
+
+1. [Checkout the ActiveMQ-CPP trunk source code](http://activemq.apache.org/cms/source.html)
+2. [Build and Install](http://activemq.apache.org/cms/building.html)
+
+Building
+========
+
+This will vary depending on where you installed your libraries and the compiler 
+you are using but on my Ubuntu system, I compiled the examples as follows:
+
+    gcc Listener.cpp -o listener -I/usr/local/include/activemq-cpp-3.2.4 -I/usr/include/apr-1.0 -lactivemq-cpp -lstdc++ 
+    gcc Publisher.cpp -o publisher -I/usr/local/include/activemq-cpp-3.2.4 -I/usr/include/apr-1.0 -lactivemq-cpp -lstdc++ 
+
+Running the Examples
+====================
+
+Note: You may need to update set an environment variable so that the 
+activemq-cpp shared libraries can be loaded.  For example on my Ubuntu 
+system I had to add the following to my profile:
+
+    export LD_LIBRARY_PATH=/usr/local/lib
+
+In one terminal window run:
+
+    ./listener
+
+In another terminal window run:
+
+    ./publisher
+
+You can control to which stomp server the examples try to connect to by
+setting the following environment variables: 
+
+* `ACTIVEMQ_HOST`
+* `ACTIVEMQ_PORT`
+* `ACTIVEMQ_USER`
+* `ACTIVEMQ_PASSWORD`

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln
new file mode 100644
index 0000000..ade0d24
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.sln
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Publisher", "Publisher\Publisher.csproj", "{0FEEC122-F3FD-4148-A461-0A724AE0C691}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Listener", "Listener\Listener.csproj", "{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.ActiveCfg = Debug|x86
+		{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Debug|x86.Build.0 = Debug|x86
+		{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.ActiveCfg = Release|x86
+		{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}.Release|x86.Build.0 = Release|x86
+		{0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.ActiveCfg = Debug|x86
+		{0FEEC122-F3FD-4148-A461-0A724AE0C691}.Debug|x86.Build.0 = Debug|x86
+		{0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.ActiveCfg = Release|x86
+		{0FEEC122-F3FD-4148-A461-0A724AE0C691}.Release|x86.Build.0 = Release|x86
+	EndGlobalSection
+	GlobalSection(MonoDevelopProperties) = preSolution
+		StartupItem = Listener\Listener.csproj
+	EndGlobalSection
+EndGlobal

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs
new file mode 100644
index 0000000..25e20b3
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/ApolloExamples.userprefs
@@ -0,0 +1,30 @@
+<Properties>
+  <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" ctype="Workspace" />
+  <MonoDevelop.Ide.Workbench ActiveDocument="Publisher/Publisher.cs" ctype="Workbench">
+    <Files>
+      <File FileName="Listener/Listener.cs" Line="51" Column="48" />
+      <File FileName="Publisher/Publisher.cs" Line="35" Column="30" />
+    </Files>
+    <Pads>
+      <Pad Id="ProjectPad">
+        <State expanded="True">
+          <Node name="Listener" expanded="True">
+            <Option id="ShowVersionControlOverlays" value="True" />
+            <Option id="ShowAllFiles" value="False" />
+          </Node>
+          <Node name="Publisher" expanded="True" selected="True">
+            <Option id="ShowVersionControlOverlays" value="True" />
+            <Option id="ShowAllFiles" value="False" />
+          </Node>
+        </State>
+      </Pad>
+      <Pad Id="ClassPad">
+        <State selected="True" />
+      </Pad>
+    </Pads>
+  </MonoDevelop.Ide.Workbench>
+  <MonoDevelop.Ide.DebuggingService.Breakpoints>
+    <BreakpointStore />
+  </MonoDevelop.Ide.DebuggingService.Breakpoints>
+  <MonoDevelop.Ide.DebuggingService.PinnedWatches ctype="PinnedWatchStore" />
+</Properties>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs
new file mode 100644
index 0000000..a1f96a9
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Listener")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs
new file mode 100644
index 0000000..91971a5
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.cs
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+using System;
+
+using Apache.NMS;
+using Apache.NMS.Stomp;
+
+namespace ActiveMQ.Example
+{
+	class Listemer
+	{
+		public static void Main(string[] args)
+		{
+			Console.WriteLine("Starting up Listener.");			
+						
+	        String user = env("ACTIVEMQ_USER", "admin");
+	        String password = env("ACTIVEMQ_PASSWORD", "password");
+	        String host = env("ACTIVEMQ_HOST", "localhost");
+	        int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613"));
+	        String destination = arg(args, 0, "event");
+	
+			String brokerUri = "stomp:tcp://" + host + ":" + port + "?transport.useLogging=true";
+	        NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri);
+	
+	        IConnection connection = factory.CreateConnection(user, password);
+	        connection.Start();
+	        ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+	        IDestination dest = session.GetTopic(destination);
+	
+	        IMessageConsumer consumer = session.CreateConsumer(dest);
+	        DateTime start = DateTime.Now;
+	        long count = 0;
+	        
+			Console.WriteLine("Waiting for messages...");
+			while (true) 
+			{
+	            IMessage msg = consumer.Receive();
+	            if (msg is ITextMessage) 
+				{
+					ITextMessage txtMsg = msg as ITextMessage;
+	                String body = txtMsg.Text;
+	                if ("SHUTDOWN".Equals(body))
+					{
+	                    TimeSpan diff = DateTime.Now - start;
+	                    Console.WriteLine(String.Format("Received {0} in {1} seconds", count, (1.0*diff.TotalMilliseconds/1000.0)));
+	                    break;
+	                } 
+					else 
+					{
+	                    if (count == 0) 
+						{
+	                        start = DateTime.Now;
+	                    }
+	                    count ++;
+	                    if (count % 1000 == 0) 
+						{
+	                        Console.WriteLine(String.Format("Received {0} messages.", count));
+	                    }
+	                }
+	
+	            }
+				else 
+				{
+	                Console.WriteLine("Unexpected message type: " + msg.GetType().Name);
+	            }
+	        }
+	        
+			Console.WriteLine("Shutting down Listener.");			
+			connection.Close();
+	    }
+	
+	    private static String env(String key, String defaultValue)
+		{
+	        String rc = System.Environment.GetEnvironmentVariable(key);
+	        if (rc == null)
+			{
+	            return defaultValue;
+			}
+	        return rc;
+	    }
+	
+	    private static String arg(String []args, int index, String defaultValue) 
+		{
+	        if (index < args.Length)
+			{
+	            return args[index];
+			}
+            return defaultValue;
+	    }
+	}
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj
new file mode 100644
index 0000000..9813110
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/Listener.csproj
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{08413D64-4C72-4F92-9B4A-9BAECCDB6DC3}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>Listener</RootNamespace>
    <AssemblyName>Listener</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLeve
 l>
    <PlatformTarget>x86</PlatformTarget>
    <Externalconsole>true</Externalconsole>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>none</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
    <Externalconsole>true</Externalconsole>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath>
    </Reference>
    <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\
 mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Listener.cs" />
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="NMSTracer.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs
new file mode 100755
index 0000000..b37af66
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Listener/NMSTracer.cs
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+using System;
+
+namespace ActiveMQ.Example
+{
+    public class NmsTracer : Apache.NMS.ITrace
+    {
+        #region ITrace Members
+        public void Debug(string message)
+        {
+            Console.WriteLine("DEBUG: " + message);
+        }
+
+        public void Error(string message)
+        {
+            Console.WriteLine("ERROR: " + message);
+        }
+
+        public void Fatal(string message)
+        {
+            Console.WriteLine("FATAL: " + message);
+        }
+
+        public void Info(string message)
+        {
+            Console.WriteLine("INFO:  " + message);
+        }
+
+        public void Warn(string message)
+        {
+            Console.WriteLine("WARN:  " + message);
+        }
+
+        public bool IsDebugEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsErrorEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsFatalEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsInfoEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsWarnEnabled
+        {
+            get { return true; }
+        }
+
+        #endregion
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs
new file mode 100644
index 0000000..2628d12
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/AssemblyInfo.cs
@@ -0,0 +1,44 @@
+/**
+ * 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.
+ */
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes. 
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("Publisher")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly, 
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs
new file mode 100755
index 0000000..b37af66
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/NMSTracer.cs
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+
+using System;
+
+namespace ActiveMQ.Example
+{
+    public class NmsTracer : Apache.NMS.ITrace
+    {
+        #region ITrace Members
+        public void Debug(string message)
+        {
+            Console.WriteLine("DEBUG: " + message);
+        }
+
+        public void Error(string message)
+        {
+            Console.WriteLine("ERROR: " + message);
+        }
+
+        public void Fatal(string message)
+        {
+            Console.WriteLine("FATAL: " + message);
+        }
+
+        public void Info(string message)
+        {
+            Console.WriteLine("INFO:  " + message);
+        }
+
+        public void Warn(string message)
+        {
+            Console.WriteLine("WARN:  " + message);
+        }
+
+        public bool IsDebugEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsErrorEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsFatalEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsInfoEnabled
+        {
+            get { return true; }
+        }
+
+        public bool IsWarnEnabled
+        {
+            get { return true; }
+        }
+
+        #endregion
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs
new file mode 100644
index 0000000..178afa2
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.cs
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+
+using System;
+
+using Apache.NMS;
+using Apache.NMS.Stomp;
+
+namespace ActiveMQ.Example
+{
+	class Publisher
+	{
+		public static void Main (string[] args)
+		{
+	        String user = env("ACTIVEMQ_USER", "admin");
+	        String password = env("ACTIVEMQ_PASSWORD", "password");
+	        String host = env("ACTIVEMQ_HOST", "localhost");
+	        int port = Int32.Parse(env("ACTIVEMQ_PORT", "61613"));
+			String destination = arg(args, 0, "event");
+	
+	        int messages = 10000;
+	        int size = 256;
+	
+	        String DATA = "abcdefghijklmnopqrstuvwxyz";
+	        String body = "";
+	        for(int i=0; i < size; i ++) 
+			{
+	            body += DATA[i%DATA.Length];
+	        }
+	
+			String brokerUri = "stomp:tcp://" + host + ":" + port;
+	        NMSConnectionFactory factory = new NMSConnectionFactory(brokerUri);
+	
+	        IConnection connection = factory.CreateConnection(user, password);
+	        connection.Start();
+	        ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+	        IDestination dest = session.GetTopic(destination);
+	        IMessageProducer producer = session.CreateProducer(dest);
+	        producer.DeliveryMode = MsgDeliveryMode.NonPersistent;
+	
+	        for (int i=1; i <= messages; i ++) 
+			{
+	            producer.Send(session.CreateTextMessage(body));
+	            if ((i % 1000) == 0) 
+				{
+	                Console.WriteLine(String.Format("Sent {0} messages", i));
+	            }
+	        }
+	
+	        producer.Send(session.CreateTextMessage("SHUTDOWN"));
+	        connection.Close();
+		}
+
+	    private static String env(String key, String defaultValue)
+		{
+	        String rc = System.Environment.GetEnvironmentVariable(key);
+	        if (rc == null)
+			{
+	            return defaultValue;
+			}
+	        return rc;
+	    }
+	
+	    private static String arg(String []args, int index, String defaultValue) 
+		{
+	        if (index < args.Length)
+			{
+	            return args[index];
+			}
+            return defaultValue;
+	    }
+	}
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj
new file mode 100644
index 0000000..1f4e30e
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/ApolloExamples/Publisher/Publisher.csproj
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{0FEEC122-F3FD-4148-A461-0A724AE0C691}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>Publisher</RootNamespace>
    <AssemblyName>Publisher</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug</OutputPath>
    <DefineConstants>DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLe
 vel>
    <PlatformTarget>x86</PlatformTarget>
    <Externalconsole>true</Externalconsole>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>none</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
    <Externalconsole>true</Externalconsole>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="Apache.NMS, Version=1.5.0.2196, Culture=neutral, PublicKeyToken=82756feee3957618">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\dev\activemq\NMS.Stomp\build\mono-2.0\debug\Apache.NMS.dll</HintPath>
    </Reference>
    <Reference Include="Apache.NMS.Stomp, Version=1.6.0.2211, Culture=neutral, PublicKeyToken=82756feee3957618">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\dev\activemq\NMS.Stomp\buil
 d\mono-2.0\debug\Apache.NMS.Stomp.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Publisher.cs" />
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="NMSTracer.cs" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/csharp/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/csharp/readme.md b/assembly/src/release/examples/stomp/csharp/readme.md
new file mode 100644
index 0000000..34a0f8f
--- /dev/null
+++ b/assembly/src/release/examples/stomp/csharp/readme.md
@@ -0,0 +1,31 @@
+Prereqs
+=======
+
+- Install [Apache.NMS.Stomp](http://activemq.apache.org/nms/download.html) 
+
+Building
+========
+
+This will vary depending on where you installed your libraries.  Open the 
+ActiveMQExamples solution in Visual Studio and update the references for the
+Listener and Publisher project to point to where you Apache.NMS.dll and 
+Apache.NMS.Stomp.dll are located.  Build both projects in the solution.
+
+Running the Examples
+====================
+
+In one terminal window run:
+
+    ./Listener.exe
+
+In another terminal window run:
+
+    ./Publisher.exe
+
+You can control to which stomp server the examples try to connect to by
+setting the following environment variables: 
+
+* `ACTIVEMQ_HOST`
+* `ACTIVEMQ_PORT`
+* `ACTIVEMQ_USER`
+* `ACTIVEMQ_PASSWORD`

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/java/pom.xml
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/java/pom.xml b/assembly/src/release/examples/stomp/java/pom.xml
new file mode 100644
index 0000000..334b56f
--- /dev/null
+++ b/assembly/src/release/examples/stomp/java/pom.xml
@@ -0,0 +1,80 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+  
+  <groupId>example</groupId>
+  <artifactId>stomp-example</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  
+  <name>example</name>
+  <description>ActiveMQ STOMP Java Examples</description>
+
+  <repositories>
+    <repository>
+      <id>Fusesource Snapshots</id>
+      <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
+    </repository>
+  </repositories>
+  
+  <dependencies>
+    
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jms_1.1_spec</artifactId>
+      <version>1.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.fusesource.stompjms</groupId>
+      <artifactId>stompjms-client</artifactId>
+      <version>${stompjms-version}</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.1</version>
+        <configuration>
+          <source>1.6</source>
+          <target>1.6</target>
+        </configuration>
+      </plugin>
+
+      <!-- include all the dependencies into the jar so it's easier to execute the example -->
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-uberize-plugin</artifactId>
+        <version>1.14</version>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals><goal>uberize</goal></goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+    </plugins>
+  </build>
+  
+</project>
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/java/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/java/readme.md b/assembly/src/release/examples/stomp/java/readme.md
new file mode 100644
index 0000000..fed1088
--- /dev/null
+++ b/assembly/src/release/examples/stomp/java/readme.md
@@ -0,0 +1,32 @@
+## Overview
+
+This is an example of how use the Java JMS api with ActiveMQ.
+
+## Prereqs
+
+- Install Java SDK
+- Install [Maven](http://maven.apache.org/download.html) 
+
+## Building
+
+Run:
+
+    mvn install
+
+## Running the Examples
+
+In one terminal window run:
+
+    java -cp target/stomp-example-0.1-SNAPSHOT.jar example.Listener
+
+In another terminal window run:
+
+    java -cp target/stomp-example-0.1-SNAPSHOT.jar example.Publisher
+
+You can control to which stomp server the examples try to connect to by
+setting the following environment variables: 
+
+* `ACTIVEMQ_HOST`
+* `ACTIVEMQ_PORT`
+* `ACTIVEMQ_USER`
+* `ACTIVEMQ_PASSWORD`

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/java/src/main/java/example/Listener.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/java/src/main/java/example/Listener.java b/assembly/src/release/examples/stomp/java/src/main/java/example/Listener.java
new file mode 100644
index 0000000..7bb4182
--- /dev/null
+++ b/assembly/src/release/examples/stomp/java/src/main/java/example/Listener.java
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+package example;
+
+import org.fusesource.stomp.jms.*;
+import javax.jms.*;
+
+class Listener {
+
+    public static void main(String []args) throws JMSException {
+
+        String user = env("ACTIVEMQ_USER", "admin");
+        String password = env("ACTIVEMQ_PASSWORD", "password");
+        String host = env("ACTIVEMQ_HOST", "localhost");
+        int port = Integer.parseInt(env("ACTIVEMQ_PORT", "61613"));
+        String destination = arg(args, 0, "/topic/event");
+
+        StompJmsConnectionFactory factory = new StompJmsConnectionFactory();
+        factory.setBrokerURI("tcp://" + host + ":" + port);
+
+        Connection connection = factory.createConnection(user, password);
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination dest = new StompJmsDestination(destination);
+
+        MessageConsumer consumer = session.createConsumer(dest);
+        long start = System.currentTimeMillis();
+        long count = 1;
+        System.out.println("Waiting for messages...");
+        while(true) {
+            Message msg = consumer.receive();
+            if( msg instanceof  TextMessage ) {
+                String body = ((TextMessage) msg).getText();
+                if( "SHUTDOWN".equals(body)) {
+                    long diff = System.currentTimeMillis() - start;
+                    System.out.println(String.format("Received %d in %.2f seconds", count, (1.0*diff/1000.0)));
+                    break;
+                } else {
+                    if( count != msg.getIntProperty("id") ) {
+                        System.out.println("mismatch: "+count+"!="+msg.getIntProperty("id"));
+                    }
+                    count = msg.getIntProperty("id");
+
+                    if( count == 0 ) {
+                        start = System.currentTimeMillis();
+                    }
+                    if( count % 1000 == 0 ) {
+                        System.out.println(String.format("Received %d messages.", count));
+                    }
+                    count ++;
+                }
+
+            } else {
+                System.out.println("Unexpected message type: "+msg.getClass());
+            }
+        }
+        connection.close();
+    }
+
+    private static String env(String key, String defaultValue) {
+        String rc = System.getenv(key);
+        if( rc== null )
+            return defaultValue;
+        return rc;
+    }
+
+    private static String arg(String []args, int index, String defaultValue) {
+        if( index < args.length )
+            return args[index];
+        else
+            return defaultValue;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/java/src/main/java/example/Publisher.java
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/java/src/main/java/example/Publisher.java b/assembly/src/release/examples/stomp/java/src/main/java/example/Publisher.java
new file mode 100644
index 0000000..3feceb4
--- /dev/null
+++ b/assembly/src/release/examples/stomp/java/src/main/java/example/Publisher.java
@@ -0,0 +1,79 @@
+/**
+ * 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.
+ */
+package example;
+
+import org.fusesource.stomp.jms.*;
+import javax.jms.*;
+
+class Publisher {
+
+    public static void main(String []args) throws JMSException {
+
+        String user = env("ACTIVEMQ_USER", "admin");
+        String password = env("ACTIVEMQ_PASSWORD", "password");
+        String host = env("ACTIVEMQ_HOST", "localhost");
+        int port = Integer.parseInt(env("ACTIVEMQ_PORT", "61613"));
+        String destination = arg(args, 0, "/topic/event");
+
+        int messages = 10000;
+        int size = 256;
+
+        String DATA = "abcdefghijklmnopqrstuvwxyz";
+        String body = "";
+        for( int i=0; i < size; i ++) {
+            body += DATA.charAt(i%DATA.length());
+        }
+
+        StompJmsConnectionFactory factory = new StompJmsConnectionFactory();
+        factory.setBrokerURI("tcp://" + host + ":" + port);
+
+        Connection connection = factory.createConnection(user, password);
+        connection.start();
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Destination dest = new StompJmsDestination(destination);
+        MessageProducer producer = session.createProducer(dest);
+        producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+        for( int i=1; i <= messages; i ++) {
+            TextMessage msg = session.createTextMessage(body);
+            msg.setIntProperty("id", i);
+            producer.send(msg);
+            if( (i % 1000) == 0) {
+                System.out.println(String.format("Sent %d messages", i));
+            }
+        }
+
+        producer.send(session.createTextMessage("SHUTDOWN"));
+        connection.close();
+
+    }
+
+    private static String env(String key, String defaultValue) {
+        String rc = System.getenv(key);
+        if( rc== null )
+            return defaultValue;
+        return rc;
+    }
+
+    private static String arg(String []args, int index, String defaultValue) {
+        if( index < args.length )
+            return args[index];
+        else
+            return defaultValue;
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/perl/listener
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/perl/listener b/assembly/src/release/examples/stomp/perl/listener
new file mode 100755
index 0000000..49de9ff
--- /dev/null
+++ b/assembly/src/release/examples/stomp/perl/listener
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+# ------------------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------------------
+#
+# sample listener
+#
+
+use strict;
+use warnings;
+use Net::STOMP::Client;
+use Time::HiRes qw(time);
+
+our(%Option, $Conn, $Count, $Start, $Run);
+
+$Option{user} = $ENV{ACTIVEMQ_USER} || "admin";
+$Option{password} = $ENV{ACTIVEMQ_PASSWORD} || "password";
+$Option{host} = $ENV{ACTIVEMQ_HOST} || "localhost";
+$Option{port} = $ENV{ACTIVEMQ_PORT} || 61613;
+$Option{destination} = $ENV{STOMP_DESTINATION} || "/topic/event";
+
+sub callback ($$) {
+    my($self, $frame) = @_;
+
+    $Start = time() unless $Count++;
+    $Run = 0 if $frame->body() eq "SHUTDOWN";
+}
+
+$Conn = Net::STOMP::Client->new(
+    host => $Option{host},
+    port => $Option{port},
+);
+$Conn->connect(
+    login    => $Option{user},
+    passcode => $Option{password},
+);
+printf("connected to %s:%d\n", $Conn->peer()->addr(), $Conn->peer()->port());
+$Conn->message_callback(\&callback);
+$Conn->subscribe(
+    destination => $Option{destination},
+    id          => 0,
+    ack         => "auto",
+);
+printf("Waiting for messages...\n");
+$Count = 0;
+$Run = 1;
+$Conn->wait_for_frames() while $Run;
+printf("received %d messages in %.3f seconds\n", $Count, time()-$Start);
+$Conn->disconnect();

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/perl/publisher
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/perl/publisher b/assembly/src/release/examples/stomp/perl/publisher
new file mode 100755
index 0000000..27dabb7
--- /dev/null
+++ b/assembly/src/release/examples/stomp/perl/publisher
@@ -0,0 +1,59 @@
+#!/usr/bin/perl
+# ------------------------------------------------------------------------
+# 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.
+# ------------------------------------------------------------------------
+#
+# sample publisher
+#
+
+use strict;
+use warnings;
+use Net::STOMP::Client;
+use Time::HiRes qw(time);
+
+our(%Option, $Conn, $Start);
+
+$Option{user} = $ENV{ACTIVEMQ_USER} || "admin";
+$Option{password} = $ENV{ACTIVEMQ_PASSWORD} || "password";
+$Option{host} = $ENV{ACTIVEMQ_HOST} || "localhost";
+$Option{port} = $ENV{ACTIVEMQ_PORT} || 61613;
+$Option{destination} = $ENV{STOMP_DESTINATION} || "/topic/event";
+$Option{count} = $ENV{STOMP_COUNT} || 10000;
+
+$Conn = Net::STOMP::Client->new(
+    host => $Option{host},
+    port => $Option{port},
+);
+$Conn->connect(
+    login    => $Option{user},
+    passcode => $Option{password},
+);
+printf("connected to %s:%d\n", $Conn->peer()->addr(), $Conn->peer()->port());
+$Start = time();
+foreach (1 .. $Option{count}) {
+    $Conn->send(
+	destination => $Option{destination},
+	persistent  => "false",
+	body        => "Hello world from Perl",
+    );
+}
+$Conn->send(
+    destination => $Option{destination},
+    persistent  => "false",
+    body        => "SHUTDOWN",
+);
+printf("sent %d messages in %.3f seconds\n", $Option{count}+1, time()-$Start);
+$Conn->disconnect();

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/perl/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/perl/readme.md b/assembly/src/release/examples/stomp/perl/readme.md
new file mode 100644
index 0000000..1d349d1
--- /dev/null
+++ b/assembly/src/release/examples/stomp/perl/readme.md
@@ -0,0 +1,12 @@
+Prereqs
+=======
+
+Install the [Net:STOMP::Client](http://search.cpan.org/dist/Net-STOMP-Client/) 
+library.
+
+CPAN users can install it by running:
+
+    cpan Net:STOMP::Client
+
+
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/php/listener.php
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/php/listener.php b/assembly/src/release/examples/stomp/php/listener.php
new file mode 100755
index 0000000..b816722
--- /dev/null
+++ b/assembly/src/release/examples/stomp/php/listener.php
@@ -0,0 +1,73 @@
+<?php
+/*
+ * 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.
+ */
+
+$user = getenv("ACTIVEMQ_USER"); 
+if( !$user ) $user = "admin";
+
+$password = getenv("ACTIVEMQ_PASSWORD");
+if( !$password ) $password = "password";
+
+$host = getenv("ACTIVEMQ_HOST");
+if( !$host ) $host = "localhost";
+
+$port = getenv("ACTIVEMQ_PORT");
+if( !$port ) $port = 61613;
+
+$destination  = '/topic/event';
+
+
+function now() { 
+  list($usec,$sec) = explode(' ', microtime());
+  return ((float)$usec + (float)$sec);
+}
+
+try {
+  $url = 'tcp://'.$host.":".$port;
+  $stomp = new Stomp($url, $user, $password);
+  $stomp->subscribe($destination);
+  
+  $start = now();
+  $count = 0;
+  echo "Waiting for messages...\n";
+  while(true) {
+    $frame = $stomp->readFrame();
+    if( $frame ) {
+      if( $frame->command == "MESSAGE" ) {
+        if($frame->body == "SHUTDOWN") {
+          $diff = round((now()-$start),2);
+          echo("Received ".$count." in ".$diff." seconds\n");
+          break;
+        } else {
+          if(  $count==0 ) {
+            $start = now();
+          }
+          if( $count%1000 == 0 ) {
+            echo "Received ".$count." messages\n";
+          }
+          $count++;
+        }
+      } else {
+        echo "Unexpected frame.\n";
+        var_dump($frame);
+      }
+    }
+  }
+
+} catch(StompException $e) {
+  echo $e->getMessage();
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/php/publisher.php
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/php/publisher.php b/assembly/src/release/examples/stomp/php/publisher.php
new file mode 100755
index 0000000..6ff0ade
--- /dev/null
+++ b/assembly/src/release/examples/stomp/php/publisher.php
@@ -0,0 +1,56 @@
+<?php
+/*
+ * 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.
+ */
+
+$user = getenv("ACTIVEMQ_USER"); 
+if( !$user ) $user = "admin";
+
+$password = getenv("ACTIVEMQ_PASSWORD");
+if( !$password ) $password = "password";
+
+$host = getenv("ACTIVEMQ_HOST");
+if( !$host ) $host = "localhost";
+
+$port = getenv("ACTIVEMQ_PORT");
+if( !$port ) $port = 61613;
+
+$destination  = '/topic/event';
+$messages = 10000;
+$size = 256;
+
+$DATA = "abcdefghijklmnopqrstuvwxyz";
+$body = "";
+for($i=0; $i< $size; $i++) {
+  $body .= $DATA[ $i % 26];
+}
+
+try {
+  $url = 'tcp://'.$host.":".$port;
+  $stomp = new Stomp($url, $user, $password);
+  
+  for($i=0; $i< $messages; $i++) {
+    $stomp->send($destination, $body);
+    if( $i%1000 == 0 ) {
+      echo "Sent ".$i." messages\n";
+    }
+  }
+  
+  $stomp->send($destination, "SHUTDOWN");
+
+} catch(StompException $e) {
+  echo $e->getMessage();
+}

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/php/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/php/readme.md b/assembly/src/release/examples/stomp/php/readme.md
new file mode 100644
index 0000000..dcf17ca
--- /dev/null
+++ b/assembly/src/release/examples/stomp/php/readme.md
@@ -0,0 +1,12 @@
+Prereqs
+=======
+
+Install the [PHP Stomp client](http://www.php.net/manual/en/book.stomp.php) 
+library.
+
+Pear users can install it by running:
+
+    pear install pecl.php.net/stomp
+
+Then you should add "extension=stomp.so" to php.ini
+

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/python/readme.md
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/python/readme.md b/assembly/src/release/examples/stomp/python/readme.md
new file mode 100644
index 0000000..12547c5
--- /dev/null
+++ b/assembly/src/release/examples/stomp/python/readme.md
@@ -0,0 +1,7 @@
+Overview
+========
+
+Python users can choose between examples for the following client libraries:
+
+* [stomppy](http://code.google.com/p/stomppy) 
+* [stompest](https://github.com/nikipore/stompest)

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/python/stompest/async/__init__.py
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/python/stompest/async/__init__.py b/assembly/src/release/examples/stomp/python/stompest/async/__init__.py
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/python/stompest/async/listener.py
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/python/stompest/async/listener.py b/assembly/src/release/examples/stomp/python/stompest/async/listener.py
new file mode 100644
index 0000000..f9c7b2b
--- /dev/null
+++ b/assembly/src/release/examples/stomp/python/stompest/async/listener.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+"""
+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.
+"""
+import os
+import sys
+import time
+
+from twisted.internet import defer, reactor
+
+from stompest.config import StompConfig
+from stompest.async import Stomp
+
+user = os.getenv('ACTIVEMQ_USER') or 'admin'
+password = os.getenv('ACTIVEMQ_PASSWORD') or 'password'
+host = os.getenv('ACTIVEMQ_HOST') or 'localhost'
+port = int(os.getenv('ACTIVEMQ_PORT') or 61613)
+destination = sys.argv[1:2] or ['/topic/event']
+destination = destination[0]
+
+messages = 10000
+
+class Listener(object):
+    @defer.inlineCallbacks
+    def run(self):
+        config = StompConfig('tcp://%s:%d' % (host, port), login=user, passcode=password, version='1.1')
+        client = Stomp(config)
+        yield client.connect(host='mybroker')
+        
+        self.count = 0
+        self.start = time.time()
+        client.subscribe(destination, self.handleFrame, headers={'ack': 'auto', 'id': 'required-for-STOMP-1.1'}, ack=False)
+        
+    @defer.inlineCallbacks
+    def handleFrame(self, client, frame):
+        self.count += 1
+        if self.count == messages:
+            self.stop(client)
+    
+    @defer.inlineCallbacks
+    def stop(self, client):
+        print 'Disconnecting. Waiting for RECEIPT frame ...',
+        yield client.disconnect(receipt='bye')
+        print 'ok'
+        
+        diff = time.time() - self.start
+        print 'Received %s frames in %f seconds' % (self.count, diff)
+        reactor.stop()
+
+if __name__ == '__main__':
+    Listener().run()
+    reactor.run()

http://git-wip-us.apache.org/repos/asf/activemq/blob/2ecf41d0/assembly/src/release/examples/stomp/python/stompest/async/publisher.py
----------------------------------------------------------------------
diff --git a/assembly/src/release/examples/stomp/python/stompest/async/publisher.py b/assembly/src/release/examples/stomp/python/stompest/async/publisher.py
new file mode 100644
index 0000000..4adc820
--- /dev/null
+++ b/assembly/src/release/examples/stomp/python/stompest/async/publisher.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+"""
+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.
+"""
+import os
+import sys
+import time
+
+from twisted.internet import defer, reactor
+
+from stompest.config import StompConfig
+from stompest.async import Stomp
+
+user = os.getenv('ACTIVEMQ_USER') or 'admin'
+password = os.getenv('ACTIVEMQ_PASSWORD') or 'password'
+host = os.getenv('ACTIVEMQ_HOST') or 'localhost'
+port = int(os.getenv('ACTIVEMQ_PORT') or 61613)
+destination = sys.argv[1:2] or ['/topic/event']
+destination = destination[0]
+
+messages = 10000
+data = 'Hello World from Python'
+
+@defer.inlineCallbacks
+def run():
+    config = StompConfig('tcp://%s:%d' % (host, port), login=user, passcode=password, version='1.1')
+    client = Stomp(config)
+    yield client.connect(host='mybroker')
+
+    count = 0
+    start = time.time()
+    
+    for _ in xrange(messages):
+        client.send(destination=destination, body=data, headers={'persistent': 'false'})
+        count += 1
+
+    diff = time.time() - start
+    print 'Sent %s frames in %f seconds' % (count, diff)
+  
+    yield client.disconnect(receipt='bye')
+
+if __name__ == '__main__':
+    run()
+    reactor.run()


Mime
View raw message