Author: ningjiang
Date: Mon Nov 2 10:19:41 2009
New Revision: 831843
URL: http://svn.apache.org/viewvc?rev=831843&view=rev
Log:
CAMEL-2125 added camel-context.xml to start the example from SericeMix
Added:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
(with props)
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
(with props)
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
(with props)
camel/trunk/examples/camel-example-jms-file/src/test/
camel/trunk/examples/camel-example-jms-file/src/test/java/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
(with props)
Modified:
camel/trunk/examples/camel-example-jms-file/pom.xml
Modified: camel/trunk/examples/camel-example-jms-file/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/pom.xml?rev=831843&r1=831842&r2=831843&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-jms-file/pom.xml (original)
+++ camel/trunk/examples/camel-example-jms-file/pom.xml Mon Nov 2 10:19:41 2009
@@ -48,9 +48,25 @@
<artifactId>camel-jms</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-camel</artifactId>
+ </dependency>
+
<dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
Added:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java?rev=831843&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
(added)
+++
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
Mon Nov 2 10:19:41 2009
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.example.jmstofile;
+
+import javax.jms.ConnectionFactory;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.camel.CamelContext;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.jms.JmsComponent;
+import org.apache.camel.impl.DefaultCamelContext;
+
+public final class JmsToFileClient {
+
+ private JmsToFileClient() {
+ //Helper class
+ }
+
+ public static void mail(String[] args) throws Exception {
+
+ CamelContext context = new DefaultCamelContext();
+
+ ConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("tcp://localhost:51616");
+
+ context.addComponent("test-jms",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
+
+ ProducerTemplate template = context.createProducerTemplate();
+
+ context.start();
+
+ for (int i = 0; i < 10; i++) {
+ template.sendBody("test-jms:queue:test.queue", "Test Message: " +
i);
+ }
+ }
+
+}
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileClient.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java?rev=831843&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
(added)
+++
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
Mon Nov 2 10:19:41 2009
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.example.jmstofile;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.builder.RouteBuilder;
+
+public class JmsToFileRoute extends RouteBuilder {
+
+ @Override
+ public void configure() throws Exception {
+ from("test-jms:queue:test.queue").to("file://test");
+ // set up a listener on the file component
+ from("file://test").process(new Processor() {
+
+ public void process(Exchange e) {
+ System.out.println("Received exchange: " + e.getIn());
+ }
+ });
+
+ }
+
+}
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/java/org/apache/camel/example/jmstofile/JmsToFileRoute.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml?rev=831843&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
(added)
+++
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
Mon Nov 2 10:19:41 2009
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:camel="http://camel.apache.org/schema/spring"
+ 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://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.3.0.xsd">
+
+ <!-- lets configure the ActiveMQ JMS broker server to listen on TCP 51616
-->
+ <broker:broker useJmx="false" persistent="false" brokerName="localhost">
+ <broker:transportConnectors>
+ <broker:transportConnector name="tcp" uri="tcp://localhost:51616"/>
+ </broker:transportConnectors>
+ </broker:broker>
+
+ <!-- lets configure the Camel ActiveMQ to use the ActiveMQ broker declared
above -->
+ <bean id="test-jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
+ <property name="brokerURL" value="tcp://localhost:51616"/>
+ </bean>
+
+ <bean id="jmsToFileRoute"
class="org.apache.camel.example.jmstofile.JmsToFileRoute"/>
+
+ <camel:camelContext>
+ <camel:routeBuilder ref="jmsToFileRoute"/>
+ </camel:camelContext>
+
+
+</beans>
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java?rev=831843&view=auto
==============================================================================
---
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
(added)
+++
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
Mon Nov 2 10:19:41 2009
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.example.jmstofile;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class JmsToFileRouteTest extends Assert {
+
+ @Test
+ public void startRoute() throws InterruptedException {
+ AbstractApplicationContext applicationContext =
+ new ClassPathXmlApplicationContext(new
String[]{"/META-INF/spring/camelContext.xml"});
+
+ Thread.sleep(2000);
+ applicationContext.stop();
+ }
+
+}
Propchange:
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/examples/camel-example-jms-file/src/test/java/org/apache/camel/example/jmstofile/JmsToFileRouteTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date