summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2014-05-04 23:34:16 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2014-05-04 23:34:16 +0200
commit5c762750101f12abd51621355a871e42fd9c7a33 (patch)
treea7dfd74f16199db618994a10cb33ac05b1a6ac17 /src/test
parent345c0d8f7738aab20d2b45fd6c5ebf911b75e2fa (diff)
downloadactivemq-plugin-5c762750101f12abd51621355a871e42fd9c7a33.tar.gz
activemq-plugin-5c762750101f12abd51621355a871e42fd9c7a33.tar.bz2
activemq-plugin-5c762750101f12abd51621355a871e42fd9c7a33.tar.xz
activemq-plugin-5c762750101f12abd51621355a871e42fd9c7a33.zip
o Getting the web configuration to work.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/jenkinsci/plugins/activemq/MessageListenerMain.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/test/java/org/jenkinsci/plugins/activemq/MessageListenerMain.java b/src/test/java/org/jenkinsci/plugins/activemq/MessageListenerMain.java
new file mode 100644
index 0000000..ed7def3
--- /dev/null
+++ b/src/test/java/org/jenkinsci/plugins/activemq/MessageListenerMain.java
@@ -0,0 +1,42 @@
+package org.jenkinsci.plugins.activemq;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.Topic;
+import java.io.IOException;
+
+public class MessageListenerMain {
+ public static void main(String[] args) throws JMSException, IOException {
+ ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://127.0.0.1:61616");
+
+ Connection connection = connectionFactory.createConnection();
+ connection.start();
+ System.out.println("Connected");
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Topic topic = session.createTopic(ActiveMqClient.TOPIC_NAME);
+ MessageConsumer consumer = session.createConsumer(topic);
+
+ while (true) {
+ System.out.println("Waiting for messages");
+ Message m = consumer.receive();
+
+ if (m instanceof TextMessage) {
+ TextMessage message = (TextMessage) m;
+
+ System.out.println("--------------------------------");
+ System.out.println(message.getText().trim());
+ System.out.println("--------------------------------");
+ } else {
+ System.out.println("Unknown message: " + m);
+ }
+ }
+ }
+}