summaryrefslogtreecommitdiff
path: root/java/client/example/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/client/example/src')
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java12
-rwxr-xr-xjava/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java18
-rw-r--r--java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties5
3 files changed, 24 insertions, 11 deletions
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java
index e813c0ce60..daa1b10b6b 100755
--- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java
+++ b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Consumer.java
@@ -59,16 +59,20 @@ public class Consumer
*
* @param args Command line arguments.
*/
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
+ if (args.length == 0)
+ {
+ throw new Exception("You need to specify the JNDI name for the queue");
+ }
Consumer syncConsumer = new Consumer();
- syncConsumer.runTest();
+ syncConsumer.runTest(args[0]);
}
/**
* Start the example.
*/
- private void runTest()
+ private void runTest(String queueName)
{
try
{
@@ -80,7 +84,7 @@ public class Consumer
Context ctx = new InitialContext(properties);
// look up destination
- Destination destination = (Destination)ctx.lookup("fanoutQueue");
+ Destination destination = (Destination)ctx.lookup(queueName);
// Lookup the connection factory
ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory");
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java
index 4d645888a3..fb750693b2 100755
--- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java
+++ b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/Listener.java
@@ -39,17 +39,17 @@ public class Listener implements MessageListener
/**
* An object to synchronize on.
*/
- private final static Object _lock = new Object();
+ private final Object _lock = new Object();
/**
* A boolean to indicate a clean finish.
*/
- private static boolean _finished = false;
+ private boolean _finished = false;
/**
* A boolean to indicate an unsuccesful finish.
*/
- private static boolean _failed = false;
+ private boolean _failed = false;
@@ -58,16 +58,20 @@ public class Listener implements MessageListener
*
* @param args Command line arguments.
*/
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
+ if (args.length == 0)
+ {
+ throw new Exception("You need to specify the JNDI name for the queue");
+ }
Listener listener = new Listener();
- listener.runTest();
+ listener.runTest(args[0]);
}
/**
* Start the example.
*/
- private void runTest()
+ private void runTest(String queueName)
{
try
{
@@ -77,7 +81,7 @@ public class Listener implements MessageListener
//Create the initial context
Context ctx = new InitialContext(properties);
- Destination destination = (Destination)ctx.lookup("fanoutQueue");
+ Destination destination = (Destination)ctx.lookup(queueName);
// Declare the connection
ConnectionFactory conFac = (ConnectionFactory)ctx.lookup("qpidConnectionfactory");
diff --git a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties
index bde9ae4dae..0f1dd43aa9 100644
--- a/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties
+++ b/java/client/example/src/main/java/org/apache/qpid/example/jmsexample/fanout/fanout.properties
@@ -25,4 +25,9 @@ connectionfactory.qpidConnectionfactory = qpid:password=pass;username=name@tcp:l
# Register an AMQP destination in JNDI
# destination.[jniName] = [BindingURL]
+destination.fanoutQueue1 = fanout://amq.fanout//message_queue1
+destination.fanoutQueue2 = fanout://amq.fanout//message_queue2
+destination.fanoutQueue3 = fanout://amq.fanout//message_queue3
+
+# for producer
destination.fanoutQueue = fanout://amq.fanout//message_queue \ No newline at end of file