Route Example

Here is a sample route for uploading data to the PFX Customer table in the Camel route context. This file should be saved in the folder src/resources/refs/routes. The file is specified as a Spring bean and it looks like this:

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:pfx="http://www.pricefx.eu/schema/pfx" 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 http://www.pricefx.eu/schema/pfx http://www.pricefx.eu/schema/pfx.xsd"> <pfx:loadMapper convertEmptyStringToNull="true" id="CustomerDataMapper"> <pfx:body in="store_num" out="customerId"/> <pfx:body in="store_nm" out="name"/> <pfx:body in="store_id" out="attribute12"/> <pfx:body in="parentbranch_num" out="attribute1"/> <pfx:body in="primaryrsc_cd" out="attribute2"/> <pfx:body in="territory_id" out="attribute3"/> <pfx:body in="storeformat_cd" out="attribute4"/> <pfx:body in="storestatus_cd" out="attribute5"/> </pfx:loadMapper> <routeContext id="customersRoutes" xmlns="http://camel.apache.org/schema/spring"> <route id="customersRoutes-uploadCustomers"> <from uri="{{customer-fromUri}}"/> <convertBodyTo charset="utf-8" type="java.lang.String"/> <log message="Loading Customers (Stores) from file ${header[CamelFileNameOnly]}" loggingLevel="INFO" logName="customer.trigger"/> <split strategyRef="recordsCountAggregation" stopOnException="true"> <tokenize group="5000" token="\n"/> <log loggingLevel="INFO" message="Running Customers batch number# ${exchangeProperty.CamelSplitIndex}"/> <to uri="pfx-csv:unmarshal?header=store_num,store_nm,store_id,parentbranch_num,primaryrsc_cd,territory_id,storeformat_cd,storestatus_cd&skipHeaderRecord=true&quoteDisabled=false&delimiter=|"/> <to uri="pfx-api:loaddata?mapper=CustomerDataMapper&objectType=C"/> </split> <log message="Customers (Stores) from file ${header[CamelFileNameOnly]} have been saved. Record count: ${headers.PfxTotalInputRecordsCount}"/> </route> </routeContext> </beans>

IntegrationManager version 5.8.0