You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/08/08 15:03:59 UTC

svn commit: r802352 - in /camel/trunk/examples/camel-example-spring-jms/src/main/resources: META-INF/spring/camel-server-aop.xml camel-client-remoting.xml camel-client.xml

Author: ningjiang
Date: Sat Aug  8 13:03:58 2009
New Revision: 802352

URL: http://svn.apache.org/viewvc?rev=802352&view=rev
Log:
Fixed the example error of camel-spring-jms

Modified:
    camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml
    camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client-remoting.xml
    camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client.xml

Modified: camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml?rev=802352&r1=802351&r2=802352&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml (original)
+++ camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server-aop.xml Sat Aug  8 13:03:58 2009
@@ -21,17 +21,38 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:camel="http://camel.apache.org/schema/spring"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:broker="http://activemq.apache.org/schema/core"
        xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd">
 <!-- END SNIPPET: e1 -->
 
     <!-- START SNIPPET: e2 -->
-    <!-- import the normal server that is the JMS broker -->
-    <import resource="camel-server.xml"/>
+    <!-- let Spring do its IoC stuff in this package -->
+    <context:component-scan base-package="org.apache.camel.example.server"/>
+    
+    <!-- lets configure the ActiveMQ JMS broker server to listen on TCP 61616 -->
+    <broker:broker useJmx="false" persistent="false" brokerName="localhost">
+        <broker:transportConnectors>
+            <broker:transportConnector name="tcp" uri="tcp://localhost:61616"/>
+        </broker:transportConnectors>
+    </broker:broker>
+    
+    <!-- lets configure the Camel JMS consumer to use the ActiveMQ broker declared above -->
+    <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
+        <property name="connectionFactory">
+            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
+                <!-- use the vm protocol as the JMS broker is running in the same jvm as Camel -->
+                <property name="brokerURL" value="vm://localhost"/>
+            </bean>
+        </property>
+    </bean>
     <!-- END SNIPPET: e2 -->
-
+    
     <!-- START SNIPPET: e3 -->
     <!-- turn on AspejctJ AOP to weave all @Aspects beans declared in this spring xml file -->
     <aop:aspectj-autoproxy/>
@@ -46,8 +67,18 @@
     <!-- END SNIPPET: e4 -->
 
     <!-- START SNIPPET: e5 -->
-    <!-- the audit store endpoint is configued as file based -->
-    <camel:endpoint id="AuditStore" uri="file://target/store"/>
+    <!-- declare a camel context that scans for classes that is RouteBuilder
+         in the package org.apache.camel.example.server -->
+    <camel:camelContext id="camel">
+        <camel:package>org.apache.camel.example.server</camel:package>
+        <!-- enable JMX connector so we can connect to the server and browse mbeans -->
+        <!-- Camel will log at INFO level the service URI to use for connecting with jconsole -->
+        <camel:jmxAgent id="agent" createConnector="true"/>
+        <!-- the audit store endpoint is configued as file based. 
+             In Camel 2.0 the endpoint should be defined in camel context -->
+        <camel:endpoint id="AuditStore" uri="file://target/store"/>
+    </camel:camelContext>
     <!-- END SNIPPET: e5 -->
+    
 
 </beans>

Modified: camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client-remoting.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client-remoting.xml?rev=802352&r1=802351&r2=802352&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client-remoting.xml (original)
+++ camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client-remoting.xml Sat Aug  8 13:03:58 2009
@@ -23,14 +23,21 @@
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
-    <import resource="camel-client.xml"/>
-
-    <!-- START SNIPPET: e1 -->
-    <!-- Camel proxy for a given service, in this case the JMS queue -->
-    <camel:proxy
-        id="multiplierProxy"
-        serviceInterface="org.apache.camel.example.server.Multiplier"
-        serviceUrl="jms:queue:numbers"/>
-    <!-- END SNIPPET: e1 -->
-
+    <camel:camelContext id="camel">
+    	<camel:template id="camelTemplate"/>
+    	<!-- START SNIPPET: e1 -->
+        <!-- Camel proxy for a given service, in this case the JMS queue 
+             In Camel 2.0 , the proxy should be defined in camelContext. -->
+          <camel:proxy
+            id="multiplierProxy"
+            serviceInterface="org.apache.camel.example.server.Multiplier"
+            serviceUrl="jms:queue:numbers"/>
+        <!-- END SNIPPET: e1 -->
+    </camel:camelContext>
+    
+    <!-- Camel JMSProducer to be able to send messages to a remote Active MQ server -->
+    <bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
+        <property name="brokerURL" value="tcp://localhost:61616"/>
+    </bean>
+    
 </beans>
\ No newline at end of file

Modified: camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client.xml?rev=802352&r1=802351&r2=802352&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client.xml (original)
+++ camel/trunk/examples/camel-example-spring-jms/src/main/resources/camel-client.xml Sat Aug  8 13:03:58 2009
@@ -26,8 +26,9 @@
 <!-- END SNIPPET: e1 -->
 
     <!-- START SNIPPET: e2 -->
-    <camel:camelContext id="camel"/>
-    <camel:template id="camelTemplate"/>
+    <camel:camelContext id="camel">
+    	<camel:template id="camelTemplate"/>
+    </camel:camelContext>
     <!-- END SNIPPET: e2 -->
 
     <!-- START SNIPPET: e3 -->