summaryrefslogtreecommitdiff
path: root/java/client/example/src
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2010-05-14 03:00:48 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2010-05-14 03:00:48 +0000
commit1318c94eff0722c27c9c45d9844485e30cd954f6 (patch)
treeb69f204d571349cbe2129ddc6bbb310b170b6092 /java/client/example/src
parent8c9519a366354763017e9c5c0d50648595ce7193 (diff)
downloadqpid-python-1318c94eff0722c27c9c45d9844485e30cd954f6.tar.gz
Removing the examples under this folder as they are not written against a proper API.
As of now we only support the JMS API. Therefore we shouldn't carry any other examples as it can create confusion. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@944086 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/client/example/src')
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DeclareQueue.java55
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java67
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/Listener.java105
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/DeclareQueue.java55
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/FannoutProducer.java66
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/Listener.java105
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/DeclareQueue.java74
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Listener.java107
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Producer.java88
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/DeclareLVQueue.java64
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Listener.java115
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Producer.java69
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicListener.java114
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicPublisher.java80
14 files changed, 0 insertions, 1164 deletions
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DeclareQueue.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DeclareQueue.java
deleted file mode 100755
index 38073cb7f2..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DeclareQueue.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.qpid.example.amqpexample.direct;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-
-/**
- * This creates a queue a queue and binds it to the
- * amq.direct exchange
- *
- */
-public class DeclareQueue
-{
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // declare and bind queue
- session.queueDeclare("message_queue", null, null);
- session.exchangeBind("message_queue", "amq.direct", "routing_key", null);
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
deleted file mode 100755
index 2234eb22da..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/DirectProducer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.apache.qpid.example.amqpexample.direct;
-/*
- *
- * 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.nio.ByteBuffer;
-
-import org.apache.qpid.api.Message;
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.Session;
-
-public class DirectProducer
-{
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRoutingKey("routing_key");
-
- for (int i=0; i<10; i++)
- {
- session.messageTransfer("amq.direct", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- new Header(deliveryProps),
- "Message " + i);
- }
-
- session.messageTransfer("amq.direct", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- new Header(deliveryProps),
- "That's all, folks!");
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/Listener.java
deleted file mode 100755
index 1ac3e85f7a..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/direct/Listener.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.qpid.example.amqpexample.direct;
-/*
- *
- * 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.nio.ByteBuffer;
-
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-/**
- * This listens to messages on a queue and terminates
- * when it sees the final message
- *
- */
-public class Listener implements SessionListener
-{
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- System.out.println("Message: " + xfr);
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- exc.printStackTrace();
- }
-
- public void closed(Session ssn) {}
-
- /**
- * This sends 10 messages to the
- * amq.direct exchange using the
- * routing key as "routing_key"
- *
- */
- public static void main(String[] args) throws InterruptedException
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // Create an instance of the listener
- Listener listener = new Listener();
- session.setSessionListener(listener);
-
- // create a subscription
- session.messageSubscribe("message_queue",
- "listener_destination",
- MessageAcceptMode.NONE,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
-
- // issue credits
- // XXX
- session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
- session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);
-
- // confirm completion
- session.sync();
-
- // wait to receive all the messages
- System.out.println("Waiting 100 seconds for messages from listener_destination");
- Thread.sleep(100*1000);
- System.out.println("Shutting down listener for listener_destination");
- session.messageCancel("listener_destination");
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/DeclareQueue.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/DeclareQueue.java
deleted file mode 100755
index 9c3ec2fb3b..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/DeclareQueue.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.apache.qpid.example.amqpexample.fanout;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-
-/**
- * This creates a queue a queue and binds it to the
- * amq.direct exchange
- *
- */
-public class DeclareQueue
-{
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // declare and bind queue
- session.queueDeclare("message_queue", null, null);
- session.exchangeBind("message_queue", "amq.fanout",null, null);
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/FannoutProducer.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/FannoutProducer.java
deleted file mode 100755
index 39d34713c6..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/FannoutProducer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.qpid.example.amqpexample.fanout;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.Session;
-
-public class FannoutProducer
-{
- /**
- * This sends 10 messages to the
- * amq.fannout exchange
- */
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRoutingKey("routing_key");
-
- for (int i=0; i<10; i++)
- {
- session.messageTransfer("amq.fanout", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- new Header(deliveryProps), "Message " + i);
- }
-
- session.messageTransfer("amq.fanout", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- new Header(deliveryProps),
- "That's all, folks!");
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/Listener.java
deleted file mode 100755
index 21f9c43cd2..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/fanout/Listener.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.apache.qpid.example.amqpexample.fanout;
-/*
- *
- * 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.nio.ByteBuffer;
-
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-/**
- * This listens to messages on a queue and terminates
- * when it sees the final message
- *
- */
-public class Listener implements SessionListener
-{
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- System.out.println("Message: " + xfr);
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- exc.printStackTrace();
- }
-
- public void closed(Session ssn) {}
-
- /**
- * This sends 10 messages to the
- * amq.direct exchange using the
- * routing key as "routing_key"
- *
- */
- public static void main(String[] args) throws InterruptedException
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // Create an instance of the listener
- Listener listener = new Listener();
- session.setSessionListener(listener);
-
- // create a subscription
- session.messageSubscribe("message_queue",
- "listener_destination",
- MessageAcceptMode.NONE,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
-
- // issue credits
- // XXX
- session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
- session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);
-
- // confirm completion
- session.sync();
-
- // check to see if we have received all the messages
- System.out.println("Waiting 100 seconds for messages from listener_destination");
- Thread.sleep(100*1000);
- System.out.println("Shutting down listener for listener_destination");
- session.messageCancel("listener_destination");
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/DeclareQueue.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/DeclareQueue.java
deleted file mode 100644
index 6fd73a59c4..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/DeclareQueue.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.apache.qpid.example.amqpexample.headers;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-
-import java.util.Map;
-import java.util.HashMap;
-
-
-public class DeclareQueue
-{
-
- /**
- * Creates 2 queues and bind them to an headers exchange. One queue receives messages with both
- * properties H1 and H2 and the other queue receives messages with either one of those properties.
- */
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // declare and bind queues
- session.queueDeclare("headers_queue_any", null, null);
- session.queueDeclare("headers_queue_all", null, null);
- // we need to declare the header: name, type, alternate exchange
- session.exchangeDeclare("test.headers", "headers", "amq.direct", null);
- // The matching algorithm is controlled by 'x-match' property
- // 'x-match' can take one of two values,
- // (i) 'all' implies that all the other pairs must match the headers
- // property of a message for that message to be routed (i.e. an AND match)
- // (ii) 'any' implies that the message should be routed if any of the
- // fields in the headers property match one of the fields in the arguments table (i.e. an OR match)
- Map<String, Object> arguments = new HashMap<String, Object>();
- arguments.put("x-match", "any");
- arguments.put("h1", "v1");
- arguments.put("h2", "v2");
- session.exchangeBind("headers_queue_any", "test.headers", "useless", arguments);
- arguments = new HashMap<String, Object>();
- arguments.put("x-match", "all");
- arguments.put("h1", "v1");
- arguments.put("h2", "v2");
- session.exchangeBind("headers_queue_all", "test.headers", "useless", arguments);
- // confirm completion
- session.sync();
- //cleanup
- session.close();
- con.close();
- }
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Listener.java
deleted file mode 100644
index dff49228a1..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Listener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.example.amqpexample.headers;
-
-
-import org.apache.qpid.transport.*;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-public class Listener implements SessionListener
-{
- private static CountDownLatch _countDownLatch = new CountDownLatch(1);
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- String body = xfr.getBodyString();
- System.out.println("Message: " + body);
- if ( body.equals("That's all, folks!"))
- {
- System.out.println("Received final message");
- _countDownLatch.countDown();
- }
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- exc.printStackTrace();
- }
-
- public void closed(Session ssn) {}
-
- /**
- * Receives messages from queue ANY and then ALL
- */
- public static void main(String[] args) throws InterruptedException
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
- // we expect to receive all the messages
- Consume(session, "headers_queue_any");
- // we expect to receive only messages that have both properties set.
- Consume(session, "headers_queue_all");
-
- //cleanup
- session.close();
- con.close();
- }
-
- private static void Consume(Session session, String queueName) throws InterruptedException
- {
- System.out.println("Consuming messages for queue " + queueName);
- _countDownLatch = new CountDownLatch(1);
- // Create an instance of the listener
- Listener listener = new Listener();
- session.setSessionListener(listener);
-
- // create a subscription
- session.messageSubscribe(queueName,
- "listener_destination",
- MessageAcceptMode.NONE,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
-
- // issue credits
- session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
- session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 100);
- // confirm completion
- session.sync();
-
- // wait to receive all the messages
- System.out.println("Waiting 100 seconds for messages from queue " + queueName);
-
- _countDownLatch.await(30, TimeUnit.SECONDS);
- System.out.println("Shutting down listener for " + queueName);
- System.out.println("=========================================");
- session.messageCancel("listener_destination");
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Producer.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Producer.java
deleted file mode 100644
index a54069889a..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/headers/Producer.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.example.amqpexample.headers;
-
-import org.apache.qpid.transport.*;
-import java.util.Map;
-import java.util.HashMap;
-
-
-public class Producer
-{
- /**
- * Sends 10 messages with a single property and 10 messages
- * with 2 properties to a headers exchange.
- */
- public static void main(String[] args)
- {
- // Create connection
- org.apache.qpid.transport.Connection con = new org.apache.qpid.transport.Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- org.apache.qpid.transport.Session session = con.createSession(0);
- DeliveryProperties deliveryProps = new DeliveryProperties();
-
- // set message headers
- MessageProperties messageProperties = new MessageProperties();
- Map<String, Object> messageHeaders = new HashMap<String, Object>();
- // set the message property
- messageHeaders.put("h1", "v1");
- messageProperties.setApplicationHeaders(messageHeaders);
- Header header = new Header(deliveryProps, messageProperties);
-
- for (int i=0; i<10; i++)
- {
- session.messageTransfer("test.headers", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- header,
- "Message H1: " + i);
- }
-
- // set message headers
- messageProperties = new MessageProperties();
- messageHeaders = new HashMap<String, Object>();
- // set the message properties
- messageHeaders.put("h1", "v1");
- messageHeaders.put("h2", "v2");
- messageProperties.setApplicationHeaders(messageHeaders);
- header = new Header(deliveryProps, messageProperties);
-
- for (int i=0; i<10; i++)
- {
- session.messageTransfer("test.headers", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- header,
- "Message H1 and H2: " + i);
- }
-
-
- session.messageTransfer("test.headers", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- header,
- "That's all, folks!" );
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/DeclareLVQueue.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/DeclareLVQueue.java
deleted file mode 100644
index 86a0f362ad..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/DeclareLVQueue.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.qpid.example.amqpexample.lvq;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.Session;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * This creates a queue a LVQueue with key test and binds it to the
- * amq.direct exchange
- *
- */
-public class DeclareLVQueue
-{
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // declare and bind queue
- Map<String, Object> arguments = new HashMap<String, Object>();
- // We use a lvq
- arguments.put("qpid.last_value_queue", true);
- // We want this queue to use the key test
- arguments.put("qpid.LVQ_key", "test");
- session.queueDeclare("message_queue", null, arguments);
- session.exchangeBind("message_queue", "amq.direct", "routing_key", null);
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-}
-
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Listener.java
deleted file mode 100644
index e17d3eef9f..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Listener.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.apache.qpid.example.amqpexample.lvq;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * This listens to messages on a queue and terminates
- * when it sees the final message
- *
- */
-public class Listener implements SessionListener
-{
- private static CountDownLatch _countDownLatch = new CountDownLatch(1);
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- String body = xfr.getBodyString();
- System.out.println("Message: " + body);
- if ( body.equals("That's all, folks!"))
- {
- System.out.println("Received final message");
- _countDownLatch.countDown();
- }
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- exc.printStackTrace();
- }
-
- public void closed(Session ssn) {}
-
- /**
- * This sends 10 messages to the
- * amq.direct exchange using the
- * routing key as "routing_key"
- *
- * @param args
- */
- public static void main(String[] args) throws InterruptedException
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // Create an instance of the listener
- Listener listener = new Listener();
- session.setSessionListener(listener);
-
- // create a subscription
- session.messageSubscribe("message_queue",
- "listener_destination",
- MessageAcceptMode.NONE,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
-
-
- // issue credits
- // XXX
- session.messageFlow("listener_destination", MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
- session.messageFlow("listener_destination", MessageCreditUnit.MESSAGE, 11);
-
- // confirm completion
- session.sync();
-
- // wait to receive all the messages
- System.out.println("Waiting 100 seconds for messages from listener_destination");
-
- _countDownLatch.await(30, TimeUnit.SECONDS);
- System.out.println("Shutting down listener for listener_destination");
- session.messageCancel("listener_destination");
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Producer.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Producer.java
deleted file mode 100644
index 482e6a6b11..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/lvq/Producer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.qpid.example.amqpexample.lvq;
-/*
- *
- * 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.Map;
-import java.util.HashMap;
-import org.apache.qpid.transport.*;
-
-public class Producer
-{
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRoutingKey("routing_key");
-
- // set message headers
- MessageProperties messageProperties = new MessageProperties();
- Map<String, Object> messageHeaders = new HashMap<String, Object>();
- // set the message key
- messageHeaders.put("qpid.LVQ_key", "test");
- messageProperties.setApplicationHeaders(messageHeaders);
-
- Header header = new Header(deliveryProps, messageProperties);
-
- for (int i=0; i<10; i++)
- {
- session.messageTransfer("amq.direct", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- header,
- "Message " + i);
- }
-
- session.messageTransfer("amq.direct", MessageAcceptMode.EXPLICIT,MessageAcquireMode.PRE_ACQUIRED,
- header,
- "That's all, folks!");
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicListener.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicListener.java
deleted file mode 100755
index dd9307ca84..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicListener.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.apache.qpid.example.amqpexample.pubsub;
-/*
- *
- * 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.nio.ByteBuffer;
-
-import org.apache.qpid.transport.Connection;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.MessageCreditUnit;
-import org.apache.qpid.transport.MessageTransfer;
-import org.apache.qpid.transport.Option;
-import org.apache.qpid.transport.Session;
-import org.apache.qpid.transport.SessionException;
-import org.apache.qpid.transport.SessionListener;
-
-
-public class TopicListener implements SessionListener
-{
-
- public void opened(Session ssn) {}
-
- public void resumed(Session ssn) {}
-
- public void message(Session ssn, MessageTransfer xfr)
- {
- DeliveryProperties dp = xfr.getHeader().get(DeliveryProperties.class);
- System.out.println("Message: " + xfr + " with routing_key " + dp.getRoutingKey());
- }
-
- public void exception(Session ssn, SessionException exc)
- {
- exc.printStackTrace();
- }
-
- public void closed(Session ssn) {}
-
- public void prepareQueue(Session session,String queueName,String bindingKey)
- {
- session.queueDeclare(queueName, null, null, Option.EXCLUSIVE, Option.AUTO_DELETE);
- session.exchangeBind(queueName, "amq.topic", bindingKey, null);
- session.exchangeBind(queueName, "amq.topic", "control", null);
-
- session.messageSubscribe(queueName, queueName,
- MessageAcceptMode.NONE,
- MessageAcquireMode.PRE_ACQUIRED,
- null, 0, null);
- // issue credits
- // XXX: need to be able to set to null
- session.messageFlow(queueName, MessageCreditUnit.BYTE, Session.UNLIMITED_CREDIT);
- session.messageFlow(queueName, MessageCreditUnit.MESSAGE, 24);
- }
-
- public void cancelSubscription(Session session,String dest)
- {
- session.messageCancel(dest);
- }
-
- public static void main(String[] args) throws InterruptedException
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // Create an instance of the listener
- TopicListener listener = new TopicListener();
- session.setSessionListener(listener);
-
- listener.prepareQueue(session,"usa", "usa.#");
- listener.prepareQueue(session,"europe", "europe.#");
- listener.prepareQueue(session,"news", "#.news");
- listener.prepareQueue(session,"weather", "#.weather");
-
- // confirm completion
- session.sync();
-
- System.out.println("Waiting 100 seconds for messages");
- Thread.sleep(100*1000);
-
- System.out.println("Shutting down listeners");
- listener.cancelSubscription(session,"usa");
- listener.cancelSubscription(session,"europe");
- listener.cancelSubscription(session,"news");
- listener.cancelSubscription(session,"weather");
-
- //cleanup
- session.close();
- con.close();
- }
-
-}
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicPublisher.java b/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicPublisher.java
deleted file mode 100755
index facf08eeca..0000000000
--- a/java/client/example/src/main/java/org/apache/qpid/example/amqpexample/pubsub/TopicPublisher.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.apache.qpid.example.amqpexample.pubsub;
-/*
- *
- * 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.qpid.transport.Connection;
-import org.apache.qpid.transport.DeliveryProperties;
-import org.apache.qpid.transport.Header;
-import org.apache.qpid.transport.MessageAcceptMode;
-import org.apache.qpid.transport.MessageAcquireMode;
-import org.apache.qpid.transport.Session;
-
-public class TopicPublisher
-{
-
- public void publishMessages(Session session, String routing_key)
- {
- // Set the routing key once, we'll use the same routing key for all
- // messages.
-
- DeliveryProperties deliveryProps = new DeliveryProperties();
- deliveryProps.setRoutingKey(routing_key);
-
- for (int i=0; i<5; i++) {
- session.messageTransfer("amq.topic", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- new Header(deliveryProps), "Message " + i);
- }
-
- }
-
- public void noMoreMessages(Session session)
- {
- session.messageTransfer("amq.topic", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED,
- new Header(new DeliveryProperties().setRoutingKey("control")),
- "That's all, folks!");
- }
-
- public static void main(String[] args)
- {
- // Create connection
- Connection con = new Connection();
- con.connect("localhost", 5672, "test", "guest", "guest",false);
-
- // Create session
- Session session = con.createSession(0);
-
- // Create an instance of the listener
- TopicPublisher publisher = new TopicPublisher();
-
- publisher.publishMessages(session, "usa.news");
- publisher.publishMessages(session, "usa.weather");
- publisher.publishMessages(session, "europe.news");
- publisher.publishMessages(session, "europe.weather");
-
- // confirm completion
- session.sync();
-
- //cleanup
- session.close();
- con.close();
- }
-}