Created
November 27, 2019 07:59
-
-
Save satyaj/43e33cf9061e86aed97d3dec79782444 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:camel="http://camel.apache.org/schema/spring" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> | |
<!-- Define a traditional camel context here --> | |
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> | |
<propertyPlaceholder id="properties" location="route.properties"/> | |
<!-- EXCLUDE-BEGIN --> | |
<endpoint id="csv2json" uri="dozer:csv2json2?sourceModel=org.acme.Customer&targetModel=org.globex.Account&marshalId=json&unmarshalId=csv&mappingFile=transformation.xml"/> | |
<!-- CSV Input & JSon OutPut DataFormat --> | |
<dataFormats> | |
<bindy classType="org.acme.Customer" id="csv" type="Csv"/> | |
<json id="json" library="Jackson"/> | |
</dataFormats> | |
<restConfiguration bindingMode="off" component="servlet" contextPath="/rest"/> | |
<rest apiDocs="true" | |
id="rest-130579d7-1c1b-409c-a496-32d6feb03006" path="/service"> | |
<post id="32d64e54-9ae4-42d3-b175-9cfd81733379" uri="/customers"> | |
<to uri="direct:inbox"/> | |
</post> | |
</rest> | |
<!-- | |
Transformation Endpoint doing csv2java conversion | |
Step 1 : csv record is converted java using camel bindy | |
Step 2 : Dozer transformation of Customer to Account | |
Step 3 : Java to Json conversion using json jackson | |
--> | |
<route id="_route1" streamCache="true"> | |
<!-- Consume files from input directory --> | |
<from id="_from1" uri="direct:inbox"/> | |
<onException id="_onException1"> | |
<exception>java.lang.IllegalArgumentException</exception> | |
<handled> | |
<constant>true</constant> | |
</handled> | |
<log id="_log1" message=">> Exception : ${body}"/> | |
<setExchangePattern id="_setExchangePattern1" pattern="InOnly"/> | |
<to id="_to1" uri="amqp:queue:errorQueue"/> | |
</onException> | |
<split id="_split1"> | |
<tokenize token=";"/> | |
<to id="_to2" ref="csv2json"/> | |
<setExchangePattern id="_setExchangePattern2" pattern="InOnly"/> | |
<to id="_to3" uri="amqp:queue:accountQueue"/> | |
<log id="_log2" message=">> Completed JSON: ${body}"/> | |
</split> | |
<transform id="_transform1"> | |
<constant>Processed the customer data</constant> | |
</transform> | |
</route> | |
<!-- EXCLUDE-END --> | |
</camelContext> | |
</beans> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment