You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "arepaka@hotmail.com" <ar...@hotmail.com> on 2012/07/10 01:34:00 UTC

Camel - BeanIO integration

It is good to know that Camel 2.10 has integration with BeanIO. I am trying
to do an example which reads a file from a location and does the process and
writes it to different file. I have written the below route, but I am not
sure if it is right. I couldn’t find any documentation for this.
Can some please help me in validating the route ?

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring-2.10.0.xsd">

    
    <bean id="process" class="beanIOTest.ProcessDeduction"/>

    
    <bean id="myAggregationStrategy"
class="beanIOTest.MyAggregationStrategy"/> 

    <camelContext xmlns="http://camel.apache.org/schema/spring">
		<dataFormats>
    		<beanio id="deduction" mapping="classpath:Deduction.xml"
streamName="chargecard"/>
    		<beanio id="deductionOutput" mapping="classpath:DeductionOutput.xml"
streamName="chargecardOutput"/>
  		</dataFormats>
  		
  		<route>
    		<from uri="file:C:/download/chargecard.txt"/>
    		<unmarshal ref="deduction"/>
    		<split strategyRef="myAggregationStrategy">
      			<simple>body</simple>
      			<bean ref="process"></bean>
      			<to uri="file:C:/download/chargecardOutput.txt"/> // Do I need to
have it hear as well ? 
  		  	</split>
    		<marshal ref="deductionOutput"/>
    		<to uri="file:C:/download/chargecardOutput.txt"/>
  		</route>
    </camelContext>

</beans>


--
View this message in context: http://camel.465427.n5.nabble.com/Camel-BeanIO-integration-tp5715787.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - BeanIO integration

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You doesn't show us you full story.
I think you should past the code of ProcessDeduction and 
MyAggregationStrategy.

BTW, I don't think you have a right split expression.
Can you double check it ?

On 7/10/12 7:34 AM, arepaka@hotmail.com wrote:
> It is good to know that Camel 2.10 has integration with BeanIO. I am trying
> to do an example which reads a file from a location and does the process and
> writes it to different file. I have written the below route, but I am not
> sure if it is right. I couldn’t find any documentation for this.
> Can some please help me in validating the route ?
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:camel="http://camel.apache.org/schema/spring"
>         xsi:schemaLocation="
>           http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>           http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring-2.10.0.xsd">
>
>
>      <bean id="process" class="beanIOTest.ProcessDeduction"/>
>
>
>      <bean id="myAggregationStrategy"
> class="beanIOTest.MyAggregationStrategy"/>
>
>      <camelContext xmlns="http://camel.apache.org/schema/spring">
> 		<dataFormats>
>      		<beanio id="deduction" mapping="classpath:Deduction.xml"
> streamName="chargecard"/>
>      		<beanio id="deductionOutput" mapping="classpath:DeductionOutput.xml"
> streamName="chargecardOutput"/>
>    		</dataFormats>
>    		
>    		<route>
>      		<from uri="file:C:/download/chargecard.txt"/>
>      		<unmarshal ref="deduction"/>
>      		<split strategyRef="myAggregationStrategy">
>        			<simple>body</simple>
>        			<bean ref="process"></bean>
>        			<to uri="file:C:/download/chargecardOutput.txt"/> // Do I need to
> have it hear as well ?
>    		  	</split>
>      		<marshal ref="deductionOutput"/>
>      		<to uri="file:C:/download/chargecardOutput.txt"/>
>    		</route>
>      </camelContext>
>
> </beans>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-BeanIO-integration-tp5715787.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang



Re: Camel - BeanIO integration

Posted by Christian Müller <ch...@gmail.com>.
Did you already checked out the unit tests at [1]?

[1]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-beanio/src/test/java/org/apache/camel/dataformat/beanio/

Best,
Christian

On Tue, Jul 10, 2012 at 1:34 AM, arepaka@hotmail.com <ar...@hotmail.com>wrote:

> It is good to know that Camel 2.10 has integration with BeanIO. I am trying
> to do an example which reads a file from a location and does the process
> and
> writes it to different file. I have written the below route, but I am not
> sure if it is right. I couldn’t find any documentation for this.
> Can some please help me in validating the route ?
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        xsi:schemaLocation="
>          http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>          http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring-2.10.0.xsd">
>
>
>     <bean id="process" class="beanIOTest.ProcessDeduction"/>
>
>
>     <bean id="myAggregationStrategy"
> class="beanIOTest.MyAggregationStrategy"/>
>
>     <camelContext xmlns="http://camel.apache.org/schema/spring">
>                 <dataFormats>
>                 <beanio id="deduction" mapping="classpath:Deduction.xml"
> streamName="chargecard"/>
>                 <beanio id="deductionOutput"
> mapping="classpath:DeductionOutput.xml"
> streamName="chargecardOutput"/>
>                 </dataFormats>
>
>                 <route>
>                 <from uri="file:C:/download/chargecard.txt"/>
>                 <unmarshal ref="deduction"/>
>                 <split strategyRef="myAggregationStrategy">
>                         <simple>body</simple>
>                         <bean ref="process"></bean>
>                         <to uri="file:C:/download/chargecardOutput.txt"/>
> // Do I need to
> have it hear as well ?
>                         </split>
>                 <marshal ref="deductionOutput"/>
>                 <to uri="file:C:/download/chargecardOutput.txt"/>
>                 </route>
>     </camelContext>
>
> </beans>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-BeanIO-integration-tp5715787.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>