Author: davsclaus
Date: Mon May 2 15:33:33 2011
New Revision: 1098628
URL: http://svn.apache.org/viewvc?rev=1098628&view=rev
Log:
CAMEL-3925: Fixed managment examnple shutdown. Yikes Spring 3 is crappy at
shutting down beans in a graceful order. Using AMQ 5.5.0 version for the XSD as
the XSD is not online and end user have trouble knowing how to instruct their
IDE to use a version from the JAR or whatever.
Modified:
camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CxfRouteCamelContext.xml
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
camel/trunk/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/queueCamelContext.xml
camel/trunk/examples/camel-example-management/pom.xml
camel/trunk/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
camel/trunk/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml
camel/trunk/examples/camel-example-pojo-messaging/src/main/resources/META-INF/spring/camel-context.xml
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
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/META-INF/spring/camel-server.xml
Modified:
camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CxfRouteCamelContext.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CxfRouteCamelContext.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CxfRouteCamelContext.xml
(original)
+++
camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CxfRouteCamelContext.xml
Mon May 2 15:33:33 2011
@@ -24,7 +24,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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.xsd
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
Modified:
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=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
(original)
+++
camel/trunk/examples/camel-example-jms-file/src/main/resources/META-INF/spring/camelContext.xml
Mon May 2 15:33:33 2011
@@ -23,7 +23,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<!-- lets configure the ActiveMQ JMS broker server to listen on TCP 51616
-->
<broker:broker id="broker" useJmx="false" persistent="false"
brokerName="localhost">
Modified:
camel/trunk/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/queueCamelContext.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/queueCamelContext.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/queueCamelContext.xml
(original)
+++
camel/trunk/examples/camel-example-loan-broker/src/main/resources/META-INF/spring/queueCamelContext.xml
Mon May 2 15:33:33 2011
@@ -23,7 +23,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<!-- lets configure the ActiveMQ JMS broker server to listen on TCP 51616
-->
<broker:broker useJmx="false" persistent="false" brokerName="localhost">
Modified: camel/trunk/examples/camel-example-management/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/pom.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-management/pom.xml (original)
+++ camel/trunk/examples/camel-example-management/pom.xml Mon May 2 15:33:33
2011
@@ -53,6 +53,12 @@
<artifactId>activemq-camel</artifactId>
</dependency>
+ <!-- xbean is required for ActiveMQ broker configuration in the spring
xml file -->
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ </dependency>
+
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
Modified:
camel/trunk/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
(original)
+++
camel/trunk/examples/camel-example-management/src/main/java/org/apache/camel/example/management/StockService.java
Mon May 2 15:33:33 2011
@@ -16,6 +16,7 @@
*/
package org.apache.camel.example.management;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
@@ -28,9 +29,15 @@ import org.apache.camel.language.XPath;
*/
public class StockService {
- private List<String> symbols;
+ private final List<String> symbols = new ArrayList<String>();
private Map<String, Integer> stat = new ConcurrentHashMap<String,
Integer>();
+ public StockService() {
+ symbols.add("IBM");
+ symbols.add("APPLE");
+ symbols.add("ORCL");
+ }
+
public String transform(@XPath("/stock/symbol/text()") String symbol,
@XPath("/stock/value/text()") String value) {
Integer hits = stat.get(symbol);
if (hits == null) {
@@ -67,7 +74,4 @@ public class StockService {
return xml.toString();
}
- public void setSymbols(List<String> symbols) {
- this.symbols = symbols;
- }
}
Modified:
camel/trunk/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml
(original)
+++
camel/trunk/examples/camel-example-management/src/main/resources/META-INF/spring/camel-context.xml
Mon May 2 15:33:33 2011
@@ -19,32 +19,21 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:u="http://www.springframework.org/schema/util"
+ xmlns:broker="http://activemq.apache.org/schema/core"
xsi:schemaLocation="
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
+ http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
- <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent"
depends-on="camel">
- <property name="brokerURL"
value="vm://localhost?broker.persistent=false"/>
- </bean>
-
- <bean id="stock" class="org.apache.camel.example.management.StockService"
depends-on="camel">
- <property name="symbols" ref="symbols"/>
- </bean>
-
- <u:list id="symbols" value-type="java.lang.String">
- <value>IBM</value>
- <value>APPLE</value>
- <value>JAVA</value>
- </u:list>
-
- <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <!-- create a CamelContext -->
+ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"
depends-on="broker">
<!-- Default JMX connector url:
"service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel" -->
<jmxAgent id="agent" createConnector="true"/>
<route>
<from uri="timer://inbox?period=5000"/>
- <bean ref="stock" method="createRandomStocks"/>
+ <bean beanType="org.apache.camel.example.management.StockService"
method="createRandomStocks"/>
<to uri="file://target/inbox"/>
</route>
@@ -63,10 +52,23 @@
<route>
<from uri="activemq:queue:stock"/>
<delay><constant>100</constant></delay>
- <bean ref="stock" method="transform"/>
+ <bean beanType="org.apache.camel.example.management.StockService"
method="transform"/>
<to uri="log:stocks?groupSize=100"/>
</route>
</camelContext>
+ <!-- create a Camel ActiveMQ component to use -->
+ <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent"
depends-on="broker">
+ <property name="brokerURL"
value="vm://myBroker?create=false&waitForStart=5000"/>
+ </bean>
+
+ <!-- create an ActiveMQ broker -->
+ <!-- do not use the shutdown hook as it would cause the broker to shutdown
when you press ctrl + c -->
+ <broker:broker id="broker" useJmx="true" persistent="false"
brokerName="myBroker" useShutdownHook="false">
+ <broker:transportConnectors>
+ <broker:transportConnector name="vm" uri="vm://myBroker"/>
+ </broker:transportConnectors>
+ </broker:broker>
+
</beans>
Modified:
camel/trunk/examples/camel-example-pojo-messaging/src/main/resources/META-INF/spring/camel-context.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-pojo-messaging/src/main/resources/META-INF/spring/camel-context.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-pojo-messaging/src/main/resources/META-INF/spring/camel-context.xml
(original)
+++
camel/trunk/examples/camel-example-pojo-messaging/src/main/resources/META-INF/spring/camel-context.xml
Mon May 2 15:33:33 2011
@@ -24,7 +24,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<!-- This creates an embedded ActiveMQ Broker -->
<broker xmlns="http://activemq.apache.org/schema/core" useJmx="false"
persistent="false" brokerName="myBroker" id="broker">
Modified:
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
(original)
+++
camel/trunk/examples/camel-example-route-throttling/src/main/resources/META-INF/spring/camel-server.xml
Mon May 2 15:33:33 2011
@@ -23,7 +23,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:51616"/>
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=1098628&r1=1098627&r2=1098628&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
Mon May 2 15:33:33 2011
@@ -28,7 +28,7 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<!-- END SNIPPET: e1 -->
<!-- START SNIPPET: e2 -->
Modified:
camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml?rev=1098628&r1=1098627&r2=1098628&view=diff
==============================================================================
---
camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
(original)
+++
camel/trunk/examples/camel-example-spring-jms/src/main/resources/META-INF/spring/camel-server.xml
Mon May 2 15:33:33 2011
@@ -26,7 +26,7 @@
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.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.xsd">
+ http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd">
<!-- END SNIPPET: e1 -->
<!-- START SNIPPET: e2 -->