camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r790504 - in /camel/trunk/components/camel-jms: ./ src/main/java/org/apache/camel/component/jms/ src/test/java/org/apache/camel/component/jms/issues/ src/test/resources/org/apache/camel/component/jms/issues/
Date Thu, 02 Jul 2009 08:53:02 GMT
Author: davsclaus
Date: Thu Jul  2 08:53:02 2009
New Revision: 790504

URL: http://svn.apache.org/viewvc?rev=790504&view=rev
Log:
CAMEL-1783: polished a bit. added jencks for connection pooling for a manual unit test.

Modified:
    camel/trunk/components/camel-jms/pom.xml
    camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
    camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/broker.xml
    camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/camelBrokerClient.xml

Modified: camel/trunk/components/camel-jms/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/pom.xml?rev=790504&r1=790503&r2=790504&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/pom.xml (original)
+++ camel/trunk/components/camel-jms/pom.xml Thu Jul  2 08:53:02 2009
@@ -117,6 +117,12 @@
       </exclusions>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.jencks</groupId>
+      <artifactId>jencks-amqpool</artifactId>
+      <version>2.1</version>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>commons-logging</groupId>

Modified: camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java?rev=790504&r1=790503&r2=790504&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
(original)
+++ camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsProducer.java
Thu Jul  2 08:53:02 2009
@@ -239,7 +239,7 @@
 
                 if (endpoint.isTransferException() && body instanceof Exception)
{
                     if (LOG.isDebugEnabled()) {
-                        LOG.debug("Reply recieved. Setting reply as Exception: " + body);
+                        LOG.debug("Reply recieved. Setting reply an Exception: " + body);
                     }
                     // we got an exception back and endpoint was configued to transfer exception
                     // therefore set response as exception
@@ -337,7 +337,8 @@
         }
 
         if (LOG.isTraceEnabled()) {
-            LOG.trace("Using JMS API " + (endpoint.isUseVersion102() ? "v1.0.2" : "v1.1"));
+            LOG.trace("Using " + (inOut ? "inOut" : "inOnly") + " jms template to send with
API "
+                    + (endpoint.isUseVersion102() ? "v1.0.2" : "v1.1"));
         }
 
         // destination should be preferred

Modified: camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java?rev=790504&r1=790503&r2=790504&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
(original)
+++ camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/issues/JmsSendToAlotOfDestinationWithSameEndpointTest.java
Thu Jul  2 08:53:02 2009
@@ -16,8 +16,11 @@
  */
 package org.apache.camel.component.jms.issues;
 
+import org.apache.camel.ExchangePattern;
 import org.apache.camel.component.jms.JmsConstants;
 import org.apache.camel.spring.SpringTestSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
 import org.junit.Test;
 import org.springframework.context.support.AbstractXmlApplicationContext;
@@ -27,7 +30,8 @@
  */
 public class JmsSendToAlotOfDestinationWithSameEndpointTest extends SpringTestSupport {
 
-    private static String URI = "activemq:queue:foo";
+    private static final transient Log LOG = LogFactory.getLog(JmsSendToAlotOfDestinationWithSameEndpointTest.class);
+    private static String URI = "activemq:queue:foo?autoStartup=false";
 
     public int getExpectedRouteCount() {
         return 0;
@@ -35,18 +39,25 @@
 
     @Test
     public void testSendToAlotOfMessageToQueues() throws Exception {
-        int size = 100;
+        int size = 1000;
+
+        LOG.info("About to send " + size + " messages");
 
         for (int i = 0; i < size; i++) {
             // use the same endpoint but provide a header with the dynamic queue we send
to
             // this allows us to reuse endpoints and not create a new endpoint for each and
every jms queue
             // we send to
-            template.sendBodyAndHeader(URI, "Hello " + i, JmsConstants.JMS_DESTINATION_NAME,
"foo" + i);
+            Thread.sleep(50);
+            if (i > 0 && i % 50 == 0) {
+                LOG.info("Send " + i + " messages so far");
+            }
+            template.sendBodyAndHeader(URI, ExchangePattern.InOnly, "Hello " + i, JmsConstants.JMS_DESTINATION_NAME,
"foo" + i);
         }
 
+        LOG.info("Send complete use jconsole to view");
+
         // now we should be able to poll a message from each queue
-//        System.out.println(size + " messages sent, use jconsole to look");
-//        Thread.sleep(99999999);
+        // Thread.sleep(99999999);
     }
 
     protected AbstractXmlApplicationContext createApplicationContext() {

Modified: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/broker.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/broker.xml?rev=790504&r1=790503&r2=790504&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/broker.xml
(original)
+++ camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/broker.xml
Thu Jul  2 08:53:02 2009
@@ -7,13 +7,13 @@
 		http://www.springframework.org/schema/beans
 			http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
 		http://activemq.apache.org/schema/core
-			http://activemq.apache.org/schema/core/activemq-core-5.3-SNAPSHOT.xsd
+			http://activemq.apache.org/schema/core/activemq-core.xsd
 	">
 
     <amq:broker brokerName="myBroker"
                 id="broker"
                 useJmx="true"
-                persistent="true"
+                persistent="false"
                 start="true"
                 dataDirectory="target/data">
 

Modified: camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/camelBrokerClient.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/camelBrokerClient.xml?rev=790504&r1=790503&r2=790504&view=diff
==============================================================================
--- camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/camelBrokerClient.xml
(original)
+++ camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/issues/camelBrokerClient.xml
Thu Jul  2 08:53:02 2009
@@ -22,12 +22,14 @@
 http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
     <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+        <jmxAgent id="agent" createConnector="true"/>
         <template id="template"/>
     </camelContext>
 
-    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
-        <property name="brokerURL" value="tcp://localhost:61616"/>
-    </bean>
+    <!-- use jencks connection pooling so its more effecient to send JMS messages -->
+    <amqpool:pool id="jmsConnectionFactory" xmlns:amqpool="http://jencks.org/amqpool/2.0"
+                  brokerURL="tcp://localhost:61616"
+                  maxConnections="8"/>
 
     <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
         <property name="connectionFactory" ref="jmsConnectionFactory"/>



Mime
View raw message