Author: marnie
Date: Tue Nov 28 07:28:47 2006
New Revision: 480088
URL: http://svn.apache.org/viewvc?view=rev&rev=480088
Log:
Further example tidy up
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriber.java
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriptionWrapper.java
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/Subscriber.java
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/SubscriptionWrapper.java
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriber.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriber.java?view=diff&rev=480088&r1=480087&r2=480088
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriber.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriber.java
Tue Nov 28 07:28:47 2006
@@ -42,6 +42,9 @@
_monitorDestinationName = _destinationName +
Statics.MONITOR_QUEUE_SUFFIX;
}
+ /**
+ * MessageListener implementation for this subscriber
+ */
public static class MonitorMessageListener implements MessageListener
{
private String _name;
@@ -52,9 +55,10 @@
}
- /*
- * Listens for heartbeat messages and acknowledges them
- */
+ /**
+ * Listens for heartbeat messages and acknowledges them
+ * @param message
+ */
public void onMessage(javax.jms.Message message)
{
_logger.info(_name + " monitor got message '" + message + "'");
@@ -79,9 +83,9 @@
}
}
- /*
- * Subscribes to Queue and attaches additional monitor listener
- */
+ /**
+ * Subscribes to Queue and attaches additional monitor listener
+ */
public void subscribeAndMonitor()
{
try
@@ -115,7 +119,9 @@
}
}
- //stop consuming
+ /**
+ * Stop consuming
+ */
public void stopMonitor()
{
try
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriptionWrapper.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriptionWrapper.java?view=diff&rev=480088&r1=480087&r2=480088
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriptionWrapper.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/MonitoredSubscriptionWrapper.java
Tue Nov 28 07:28:47 2006
@@ -19,9 +19,6 @@
package org.apache.qpid.example.subscriber;
import org.apache.log4j.BasicConfigurator;
-import org.apache.qpid.example.shared.Statics;
-
-import java.util.Properties;
/**
* Allows you to simply start a monitored subscriber
@@ -30,6 +27,10 @@
private static MonitoredSubscriber _subscriber;
+ /**
+ * Create a monitored subscriber and start it
+ * @param args - no params required
+ */
public static void main(String args[])
{
//switch on logging
@@ -37,15 +38,12 @@
_subscriber = new MonitoredSubscriber();
- //using system props but can replace with app appropriate config here
- Properties props = System.getProperties();
-
- //note that for failover should set -Dhost=host1:port1;host2:port2
- //Client will then failover in order i.e. connect to first host and
failover to second and so on
_subscriber.subscribe();
}
- //Stop subscribing now ...
+ /**
+ * Stop subscribing now ...
+ */
public static void stop()
{
_subscriber.stop();
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/Subscriber.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/Subscriber.java?view=diff&rev=480088&r1=480087&r2=480088
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/Subscriber.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/Subscriber.java
Tue Nov 28 07:28:47 2006
@@ -69,9 +69,9 @@
}
}
- /*
- * Listener class that handles messages
- */
+ /**
+ * Listener class that handles messages
+ */
public static class ExampleMessageListener implements MessageListener
{
private String _name;
@@ -82,10 +82,10 @@
}
- /*
- * Listens for message callbacks, handles and then acknowledges them
- * @param message - the message received
- */
+ /**
+ * Listens for message callbacks, handles and then acknowledges them
+ * @param message - the message received
+ */
public void onMessage(javax.jms.Message message)
{
_log.info(_name + " got message '" + message + "'");
@@ -113,9 +113,9 @@
}
}
- /*
- * Subscribes to example Queue and attaches listener
- */
+ /**
+ * Subscribes to example Queue and attaches listener
+ */
public void subscribe()
{
_log.info("Starting subscription ...");
@@ -160,14 +160,18 @@
}
}
+ /**
+ * Set destination (queue or topic) name
+ * @param name
+ */
public void setDestinationName(String name)
{
_destinationName = name;
}
- /*
- * stop consuming and close connection
- */
+ /**
+ * Stop consuming and close connection
+ */
public void stop()
{
try
Modified:
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/SubscriptionWrapper.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/SubscriptionWrapper.java?view=diff&rev=480088&r1=480087&r2=480088
==============================================================================
---
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/SubscriptionWrapper.java
(original)
+++
incubator/qpid/trunk/qpid/java/client/src/test/java/org/apache/qpid/example/subscriber/SubscriptionWrapper.java
Tue Nov 28 07:28:47 2006
@@ -18,10 +18,6 @@
*/
package org.apache.qpid.example.subscriber;
-import org.apache.qpid.example.shared.Statics;
-
-import java.util.Properties;
-
import org.apache.log4j.BasicConfigurator;
/**
@@ -31,6 +27,10 @@
private static Subscriber _subscriber;
+ /**
+ * Create a subscriber and start it
+ * @param args
+ */
public static void main(String args[])
{
//switch on logging
@@ -38,15 +38,12 @@
_subscriber = new Subscriber();
- //using system props but can replace with app appropriate config here
- Properties props = System.getProperties();
-
- //note that for failover should set -Dhost=host1:port1;host2:port2
- //Client will then failover in order i.e. connect to first host and
failover to second and so on
_subscriber.subscribe();
}
- //Stop subscribing now ...
+ /**
+ * Stop subscribing now ...
+ */
public static void stop()
{
_subscriber.stop();