我正在尝试使用WSO EI 6.3.0创建一个集成方案,并且具有以下方案并且无法使其正常工作:
我创建了一个代理,用于读取CSV文件并将其推入顺序。 。我尝试过的:
我正在到达聚合器步骤,但我没有跳过它。
我在做什么错?还是用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>
答案 0 :(得分:0)
使用VFS一次只能处理一个文件,从它正在侦听的位置拾取的每个文件都会启动一个新线程。基本上,这是一封新消息给您的代理。
您可以使用file connector解决此问题。根据您的要求以及如何标识文件集,您仍然可以使用vfs触发该过程,然后使用文件连接器收集其他文件。或安排一个计划任务来触发您的服务,然后使用文件连接器以给定的时间间隔查找一组文件。
要获得更详尽的答案,我将需要更多有关您尝试处理的文件集,文件名模式,是否每次都设置一定数量的文件等信息。
希望这会有所帮助