我正在尝试使用 WSO EI 6.3.0 创建一个集成场景,并且有以下场景并且不让它工作:
- 我在由系统“A”编写的文件夹“IN”中有一组包含相关实体的多个 CSV 文件(假设一开始只有两个,客户和订单)
- 最后,我想在文件夹“OUT”中创建一个嵌套了 CSV 内容的 XML(例如,将订单作为客户的子项)以供系统“B”读取
我创建了一个代理读取 CSV 文件并将它们推送到 inSequence。. 我尝试了什么:
- 创建一个克隆中介以将文件发送到一些转换序列(每个 CSV 文件类型一个)。之后使用过滤器和 smooks 创建了一个 XML 有效负载
- 在聚合器中收集消息,最后将它们写入文件
我正在到达聚合器步骤,但我没有跨过它。
我究竟做错了什么?或者这个用例是否可能无法通过 WSO2 EI 实现?
在我的代码下面找到。预先感谢您的支持。
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="FileReaderProxy" startOnLoad="true" transports="vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property name="AggregatedResponses" scope="default">
<metasyst/>
</property>
<property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/>
<log description="Enter In Sequence" level="full">
<property name="Step" value="Enter In Sequence"/>
<property expression="get-property('fileName')" name="Filename : "/>
</log>
<clone continueParent="true" id="csvFileSet">
<target>
<sequence>
<property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/>
<log description="Enter Order Clone Branch" level="full">
<property name="Step" value="Enter Order Clone Branch"/>
<property expression="get-property('fileName')" name="Reading File : "/>
</log>
<filter xpath="get-property('fileName')='auftraege.csv'">
<then>
<smooks config-key="conf:myresources/order-smooks-config.xml">
<input type="text"/>
<output type="xml"/>
</smooks>
<log description="Exit Order Clone Branch" level="full">
<property name="Step" value="Exit Order Clone Branch"/>
</log>
</then>
<else>
<log description="Drop Order Clone Branch" level="full">
<property name="Step" value="Drop Order Clone Branch"/>
</log>
<drop/>
</else>
</filter>
</sequence>
</target>
<target>
<sequence>
<property description="Get File Name" expression="$trp:FILE_NAME" name="fileName" scope="default" type="STRING"/>
<log description="Enter Customer Clone Branch" level="full">
<property name="Step" value="Enter Customer Clone Branch"/>
<property expression="get-property('fileName')" name="Reading File : "/>
</log>
<filter xpath="get-property('fileName')='kunden.csv'">
<then>
<smooks config-key="conf:myresources/customer-smooks-config.xml">
<input type="text"/>
<output type="xml"/>
</smooks>
<log description="Exit Customer Clone Branch" level="full">
<property name="Step" value="Exit Customer Clone Branch"/>
</log>
</then>
<else>
<log description="Exit Customer Clone Branch" level="full">
<property name="Step" value="Exit Customer Clone Branch"/>
</log>
<drop/>
</else>
</filter>
</sequence>
</target>
</clone>
<log description="Enter aggregation" level="full">
<property name="Step" value="Enter aggregation"/>
</log>
<property name="AggregatedResponses" scope="default">
<metasyst/>
</property>
<aggregate id="csvFileSet">
<completeCondition>
<messageCount max="-1" min="2"/>
</completeCondition>
<onComplete enclosingElementProperty="AggregatedResponses" expression="$body/*[1]" xmlns:ns="http://org.apache.synapse/xsd">
<log description="Start Output File Writing" level="full">
<property name="Step" value="Start Output File Writing"/>
</log>
<property description="OUT_ONLY" name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<send>
<endpoint>
<address uri="vfs:file:///D:/Programme/WSO2-EI/Samples/files/4-out"/>
</endpoint>
</send>
</onComplete>
</aggregate>
</inSequence>
<outSequence/>
<faultSequence>
<drop/>
</faultSequence>
</target>
<parameter name="transport.PollInterval">1</parameter>
<parameter name="transport.vfs.FileURI">file:///D:/Programme/WSO2-EI/Samples/files/1-in</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///D:/Programme/WSO2-EI/Samples/files/3-error</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///D:/Programme/WSO2-EI/Samples/files/2-success</parameter>
</proxy>