activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r520220 - in /activemq/camel/trunk/camel-jms/src: main/java/org/apache/camel/jms/JmsComponent.java test/java/org/apache/camel/jms/JmsRouteTest.java
Date Tue, 20 Mar 2007 02:12:46 GMT
Author: jstrachan
Date: Mon Mar 19 19:12:45 2007
New Revision: 520220

URL: http://svn.apache.org/viewvc?view=rev&rev=520220
Log:
tidied up the DSL for JMS when using clientAcknowledge

Modified:
    activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/jms/JmsComponent.java
    activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java

Modified: activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/jms/JmsComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/jms/JmsComponent.java?view=diff&rev=520220&r1=520219&r2=520220
==============================================================================
--- activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/jms/JmsComponent.java (original)
+++ activemq/camel/trunk/camel-jms/src/main/java/org/apache/camel/jms/JmsComponent.java Mon
Mar 19 19:12:45 2007
@@ -27,6 +27,7 @@
 import org.springframework.jms.listener.DefaultMessageListenerContainer;
 
 import javax.jms.ConnectionFactory;
+import javax.jms.Session;
 
 /**
  * @version $Revision$
@@ -57,6 +58,16 @@
      */
     public static JmsComponent jmsComponent(ConnectionFactory connectionFactory) {
         return jmsComponent(new JmsTemplate(connectionFactory));
+    }
+
+    /**
+     * Static builder method
+     */
+    public static JmsComponent jmsComponentClientAcknowledge(ConnectionFactory connectionFactory)
{
+        JmsTemplate template = new JmsTemplate(connectionFactory);
+        template.setSessionTransacted(false);
+        template.setSessionAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
+        return jmsComponent(template);
     }
 
 

Modified: activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java?view=diff&rev=520220&r1=520219&r2=520220
==============================================================================
--- activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java (original)
+++ activemq/camel/trunk/camel-jms/src/test/java/org/apache/camel/jms/JmsRouteTest.java Mon
Mar 19 19:12:45 2007
@@ -23,10 +23,9 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
-import static org.apache.camel.jms.JmsComponent.jmsComponent;
-import org.springframework.jms.core.JmsTemplate;
+import static org.apache.camel.jms.JmsComponent.jmsComponentClientAcknowledge;
 
-import javax.jms.Session;
+import javax.jms.ConnectionFactory;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -40,11 +39,8 @@
         CamelContainer container = new CamelContainer();
 
         // lets configure some componnets
-        JmsTemplate template = new JmsTemplate(new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"));
-        template.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE);
-        template.setSessionTransacted(false);
-        
-        container.addComponent("activemq", jmsComponent(template));
+        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
+        container.addComponent("activemq", jmsComponentClientAcknowledge(connectionFactory));
 
         // lets add some routes
         container.routes(new RouteBuilder() {



Mime
View raw message