<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.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
    ">

    <bean id="transactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
      <property name="connectionFactory" ref="pooledConnectionFactory"/>
    </bean>

      <bean id="localJMS" class="org.apache.activemq.camel.component.ActiveMQComponent">
            <property name="connectionFactory" ref="pooledConnectionFactory"/>
            <property name="transactionManager" ref="transactionManager"/>
            <property name="transacted" value="true"/>
      </bean>

    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route id="orders">
            <from uri="localJMS:fidEtpOrders" />
            <transacted/>
            <!-- <log loggingLevel="INFO" message="from activemq:fidessaTrades: ${body}" /> -->
            <bean ref="canError" method="enrich" />
            <wireTap uri="localJMS:ordersTap" />
            <to uri="localJMS:fidessaOrders" />
        </route>
    </camelContext>

   <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
       <property name="brokerURL" value="vm://testDlq" />
       <property name="redeliveryPolicy" ref="redeliveryPolicy"/>
   </bean>

   <bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
       <property name="maximumRedeliveries" value="1"/>
   </bean>

   <bean id="pooledConnectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory">
       <property name="maxConnections" value="8" />
       <property name="connectionFactory" ref="activemqConnectionFactory" />
   </bean>

   <!--  only for jta - not jms tm
   bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager" init-method="recoverResource">
         <property name="transactionManager" ref="transactionManager" />
         <property name="connectionFactory" ref="activemqConnectionFactory" />
         <property name="resourceName" value="activemq.default" />
   </bean -->

    <bean id="canError" class="org.apache.activemq.camel.DlqTest$CanError"/>
</beans>
