| <?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:broker="http://activemq.apache.org/schema/core" |
| 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.org/config/1.0/1.0.xsd"> |
| |
| <!-- activemq broker --> |
| <broker:broker id="broker" useJmx="false" persistent="false" brokerName="localhost"> |
| <broker:transportConnectors> |
| <broker:transportConnector name="tcp" uri="vm://localhost?broker.persistent=false"/> |
| </broker:transportConnectors> |
| </broker:broker> |
| |
| <!-- camel stuff below to send and listen to broker with a spring JMS transaction manager --> |
| <bean id="poolConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop"> |
| <property name="maxConnections" value="8"/> |
| <property name="connectionFactory" ref="jmsConnectionFactory"/> |
| </bean> |
| |
| <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="broker"> |
| <property name="brokerURL" value="vm://localhost?broker.persistent=false"/> |
| </bean> |
| |
| <bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager"> |
| <property name="connectionFactory" ref="poolConnectionFactory"/> |
| </bean> |
| |
| <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> |
| <property name="connectionFactory" ref="poolConnectionFactory"/> |
| <property name="transactionManager" ref="jmsTransactionManager"/> |
| <property name="transacted" value="true"/> |
| <property name="concurrentConsumers" value="1"/> |
| </bean> |
| |
| <bean id="activemq" class="org.apache.camel.component.activemq.ActiveMQComponent"> |
| <property name="configuration" ref="jmsConfig"/> |
| </bean> |
| |
| <!-- If we don't use transaction support defined in jmsConfig, test will succeed |
| <bean id="activemq" class="org.apache.camel.component.activemq.ActiveMQComponent"> |
| <property name="connectionFactory" ref="jmsFactory"/> |
| </bean> |
| --> |
| |
| <bean id="consumer" class="org.apache.camel.itest.jms.JmsPollingConsumerTest$Consumer"/> |
| |
| <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> |
| |
| <template id="camelTemplate"/> |
| <consumerTemplate id="consumerTemplate"/> |
| |
| <route> |
| <from uri="activemq:startConsumer"/> |
| <delay> |
| <constant>1000</constant> |
| </delay> |
| <to uri="bean:consumer"/> |
| <to uri="mock:result"/> |
| </route> |
| |
| <route> |
| <from uri="direct:startConsumer"/> |
| <delay> |
| <constant>1000</constant> |
| </delay> |
| <to uri="bean:consumer"/> |
| <to uri="mock:result"/> |
| </route> |
| |
| </camelContext> |
| |
| </beans> |