activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r419761 - in /incubator/activemq/trunk/assembly/src/release/example: build.xml src/ConsumerTool.java src/RequesterTool.java
Date Fri, 07 Jul 2006 01:31:27 GMT
Author: chirino
Date: Thu Jul  6 18:31:26 2006
New Revision: 419761

URL: http://svn.apache.org/viewvc?rev=419761&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQ-800

Added:
    incubator/activemq/trunk/assembly/src/release/example/src/RequesterTool.java
      - copied unchanged from r419754, incubator/activemq/branches/activemq-4.0/assembly/src/release/example/src/RequesterTool.java
Modified:
    incubator/activemq/trunk/assembly/src/release/example/build.xml
    incubator/activemq/trunk/assembly/src/release/example/src/ConsumerTool.java

Modified: incubator/activemq/trunk/assembly/src/release/example/build.xml
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/example/build.xml?rev=419761&r1=419760&r2=419761&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/example/build.xml (original)
+++ incubator/activemq/trunk/assembly/src/release/example/build.xml Thu Jul  6 18:31:26 2006
@@ -168,6 +168,25 @@
 		</java>
 	</target>
 
+	<target name="requester" depends="compile" description="Runs a simple requester">
+
+		<echo>Running requester against server at $$url = ${url} for subject $$subject =
${subject}</echo>
+		<java classname="RequesterTool" fork="yes" maxmemory="100M">
+			<classpath refid="javac.classpath" />
+			<jvmarg value="-server" />
+			<arg value="${url}" />
+			<arg value="${topic}" />
+			<arg value="${subject}" />
+			<arg value="${durable}" />
+			<arg value="${max}" />
+			<arg value="${messageSize}" />
+			<arg value="${producerClientId}" />
+			<arg value="${timeToLive}" />
+			<arg value="${sleepTime}" />
+			<arg value="${transacted}" />
+		</java>
+	</target>
+
 	<target name="embedBroker" depends="compile" description="Runs a simple producer">
 
 		<echo>Running an embedded broker example</echo>

Modified: incubator/activemq/trunk/assembly/src/release/example/src/ConsumerTool.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/assembly/src/release/example/src/ConsumerTool.java?rev=419761&r1=419760&r2=419761&view=diff
==============================================================================
--- incubator/activemq/trunk/assembly/src/release/example/src/ConsumerTool.java (original)
+++ incubator/activemq/trunk/assembly/src/release/example/src/ConsumerTool.java Thu Jul  6
18:31:26 2006
@@ -16,11 +16,13 @@
  */
 
 import javax.jms.Connection;
+import javax.jms.DeliveryMode;
 import javax.jms.ExceptionListener;
 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;
@@ -41,8 +43,10 @@
     private boolean pauseBeforeShutdown;
     private boolean running;
     private Session session;
+
     private long sleepTime=0;
     private long receiveTimeOut=0;
+	private MessageProducer replyProducer;
 
     public static void main(String[] args) {
         ConsumerTool tool = new ConsumerTool();
@@ -88,6 +92,10 @@
             Connection connection = createConnection();
             connection.setExceptionListener(this);
             session = createSession(connection);
+            
+            replyProducer = session.createProducer(null);
+            replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            
             MessageConsumer consumer = null;
             if (durable && topic) {
                 consumer = session.createDurableSubscriber((Topic) destination, consumerName);
@@ -133,6 +141,14 @@
             if(transacted) {
                 session.commit();
             }
+            
+            if ( message.getJMSReplyTo() !=null ) {            	
+            	replyProducer.send(message.getJMSReplyTo(), session.createTextMessage("Reply:
"+message.getJMSMessageID()));
+                if(transacted) {
+                    session.commit();
+                }
+            }
+            
             /*
             if (++count % dumpCount == 0) {
                 dumpStats(connection);



Mime
View raw message