| <?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: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://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.5.0.xsd"> |
| |
| <!-- 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 beanType="org.apache.camel.example.management.StockService" method="createRandomStocks"/> |
| <to uri="file://target/inbox"/> |
| </route> |
| |
| <route> |
| <from uri="file://target/inbox"/> |
| <split> |
| <xpath>/stocks/stock</xpath> |
| <!-- throttle 10 msg/sec being send the the ActiveMQ queue --> |
| <throttle> |
| <constant>10</constant> |
| <to uri="activemq:queue:stock"/> |
| </throttle> |
| </split> |
| </route> |
| |
| <route> |
| <from uri="activemq:queue:stock"/> |
| <delay><constant>100</constant></delay> |
| <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> |