Guest User

sancho

a guest
Feb 10th, 2010
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.36 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.     <!--
  3.         Licensed to the Apache Software Foundation (ASF) under one or more
  4.         contributor license agreements. See the NOTICE file distributed with
  5.         this work for additional information regarding copyright ownership.
  6.         The ASF licenses this file to You under the Apache License, Version
  7.         2.0 (the "License"); you may not use this file except in compliance
  8.         with the License. You may obtain a copy of the License at
  9.  
  10.         http://www.apache.org/licenses/LICENSE-2.0 Unless required by
  11.         applicable law or agreed to in writing, software distributed under the
  12.         License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  13.         CONDITIONS OF ANY KIND, either express or implied. See the License for
  14.         the specific language governing permissions and limitations under the
  15.         License.
  16.     -->
  17.  
  18.     <!-- Configures the Camel Context-->
  19.     <!-- author: Muhammad Ichsan ([email protected]) -->
  20.    
  21. <beans xmlns="http://www.springframework.org/schema/beans"
  22.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  23.  
  24.     xsi:schemaLocation="
  25.         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  26.         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.0.0.xsd">
  27.  
  28.     <!-- ActiveMQ -->
  29.     <bean name="activemq" class="org.apache.camel.component.jms.JmsComponent">
  30.         <property name="connectionFactory" ref="jmsConnectionFactory" />
  31.     </bean>
  32.    
  33.     <bean id="jmsConnectionFactory" class="org.jencks.amqpool.PooledConnectionFactory">
  34.         <!-- <constructor-arg value="vm://localhost?broker.persistent=false" />  -->
  35.         <!-- <constructor-arg value="tcp://localhost:61616?broker.persistent=false" /> Teknik ini tidak dapat menampilkan queue di webconsole -->
  36.         <constructor-arg value="vm://localhost" />  <!-- Teknik ini dapat menampilkan queue di webconsole activemq-->
  37.        
  38.         <property name="maxConnections" value="8" />
  39.     </bean>
  40.  
  41.  
  42.  
  43.  
  44.     <bean class="id.co.mama.rxpoc.Biller">
  45.         <property name="port" value="4488"/>
  46.     </bean>
  47.    
  48.     <bean id="m2mAdapter" class="id.co.mama.rxpoc.BillerAdapter">
  49.         <property name="hostname" value="localhost" />
  50.         <property name="port" value="4488" />
  51.         <property name="jmsTemplate" ref="jmsTemplate" />
  52.         <property name="innerDestinationName" value="poc.m2m.adapter.out" />
  53.     </bean>
  54.  
  55.     <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  56.         <property name="connectionFactory" ref="jmsConnectionFactory" />
  57.         <property name="destinationName" value="poc.m2m.adapter.in" />
  58.         <property name="messageListener" ref="m2mAdapter" />
  59.         <property name="concurrentConsumers" value="15" />
  60.     </bean>
  61.    
  62.     <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
  63.         <property name="connectionFactory">
  64.             <ref bean="jmsConnectionFactory" />
  65.         </property>
  66.         <property name="receiveTimeout">
  67.             <value>20000</value>
  68.         </property>
  69.     </bean>
  70.    
  71.     <bean id="fakerxCore" class="id.co.mama.rxpoc.QueueAutoAnalyzer">
  72.         <property name="innerDestinationName" value="poc.rx_in"/>
  73.         <property name="jmsTemplate" ref="jmsTemplate" />
  74.     </bean>
  75.    
  76.     <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  77.         <property name="connectionFactory" ref="jmsConnectionFactory" />
  78.         <property name="destinationName" value="poc.rx_out" />
  79.         <property name="messageListener" ref="fakerxCore" />
  80.         <property name="concurrentConsumers" value="15" />
  81.     </bean>
  82.    
  83.     <bean id="reverser" class="id.co.mama.learn.camelspeed.StringReverser" />
  84.  
  85.     <bean id="consolePrinter" class="id.co.mama.learn.camelspeed.ConsolePrinter" />
  86.  
  87.     <bean id="speaker" class="id.co.mama.learn.camelspeed.Speaker" />
  88.  
  89.     <camelContext xmlns="http://camel.apache.org/schema/spring">
  90.         <!-- @rx -->
  91.         <route>
  92.             <from uri="activemq:poc.rx_in?concurrentConsumers=15"/>
  93.            
  94.             <onException>
  95.                 <exception>org.apache.camel.ExchangeTimedOutException</exception>
  96.                 <!-- mark this as handled -->
  97.                 <handled><constant>true</constant></handled>
  98.                
  99.                 <wireTap uri="direct:saySomething">
  100.                     <body><constant>OMG! Timeout in inOut poc.m2m.invoker.in</constant></body>
  101.                 </wireTap>
  102.                 <to uri="direct:timeOut" />
  103.             </onException>
  104.            
  105.             <inOut uri="activemq:poc.m2m.invoker.in" />
  106.              <!--
  107.             <to uri="bean:reverser?method=reverse" />
  108.               -->
  109.              
  110.             <to uri="bean:consolePrinter?method=print" />
  111.             <to uri="activemq:poc.rx_out"/>
  112.         </route>
  113.        
  114.         <!-- @Invoker -->
  115.         <route>
  116.             <from uri="activemq:poc.m2m.invoker.in?concurrentConsumers=15"/>
  117.            
  118.             <onException>
  119.                 <exception>org.apache.camel.ExchangeTimedOutException</exception>
  120.                 <!-- mark this as handled -->
  121.                 <handled><constant>true</constant></handled>
  122.                
  123.                 <wireTap uri="direct:saySomething">
  124.                     <body><constant>OMG! Timeout inOut poc.m2m.adapter.in</constant></body>
  125.                 </wireTap>
  126.                 <to uri="direct:timeOut" />
  127.             </onException>
  128.            
  129.             <!-- <inOut uri="activemq:poc.m2m.adapter.in?replyTo=queue:poc.m2m.adapter.out"/> -->
  130.             <to uri="bean:reverser?method=reverse" />
  131.            
  132.             <to uri="bean:consolePrinter?method=print"/>
  133.         </route>
  134.        
  135.         <route>
  136.             <from uri="direct:timeOut" />
  137.             <to uri="bean:speaker?method=announceTimeout" />
  138.             <to uri="bean:consolePrinter?method=print" />
  139.         </route>
  140.        
  141.         <route>
  142.             <from uri="direct:saySomething" />
  143.             <to uri="bean:consolePrinter?method=print" />
  144.         </route>
  145.        
  146.     </camelContext>
  147.  
  148. </beans>
Advertisement
Add Comment
Please, Sign In to add comment