如何在WSO2 ESB中的两个ftp服务器之间传输文件?

时间:2016-05-06 20:17:19

标签: apache ftp wso2esb

使用WSO2 ESB 4.9.0,我创建了一个代理服务,用于将文件从一个FTP位置传输到另一个FTP位置。在axis2.xml中,我启用了VFS传输,并相应地为pdf contexttype配置了messagebuilder和messageformatter。但我收到错误说" ERROR Axis2Sender在发送消息时出现意外错误"

我是ESB产品的新手。任何人都可以帮我理解我在这里遇到的问题吗?

我的代理服务配置:

<proxy name="StockQuoteProxy" transports="vfs">
    <parameter name="transport.vfs.FileURI">ftp://{user}:{pwd}@{host}/{directory}</parameter>
    <!--CHANGE-->
    <parameter name="transport.vfs.ContentType">application/pdf</parameter>
    <parameter name="transport.vfs.FileNamePattern">.*\.pdf</parameter>
    <parameter name="transport.PollInterval">15</parameter>
    <parameter name="transport.vfs.MoveAfterProcess">file://C:/VFStest/original</parameter>
    <!--CHANGE-->
    <parameter name="transport.vfs.MoveAfterFailure">file://C:/VFStest/original</parameter>
    <!--CHANGE-->
    <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
    <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>

    <target>
        <inSequence>
            <log description="Log Message" level="custom">
                <property name="message" value="Transfering file"/>
            </log>
            <property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
            <send>
                <endpoint name="FileEP">
                    <address uri="vfs:ftp://{user}:{pwd}@{host}/{directory}"/>
                </endpoint>
            </send>
        </inSequence>
    </target>
    <!--publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/-->
</proxy>

异常追踪:

2016-05-06 14:38:01,037 [-] [vfs-Worker-2] ERROR Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: The VFS transport doesn't support synchronous responses. Please use the appropriate (out only) message exchange pattern.
    at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:116)
    at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
    at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:185)
    at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:167)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
    at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:542)
    at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:79)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:461)
    at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:372)
    at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:65)
    at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:105)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:185)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
    at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:751)
    at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:407)
    at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:177)
    at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:124)
    at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
2016-05-06 14:38:01,056 [-] [vfs-Worker-2]  WARN ProxyServiceMessageReceiver Executing fault handler due to exception encountered
2016-05-06 14:38:01,058 [-] [vfs-Worker-2]  WARN FaultHandler ERROR_CODE : 0
2016-05-06 14:38:01,059 [-] [vfs-Worker-2]  WARN FaultHandler ERROR_MESSAGE : Unexpected error during sending message out
2016-05-06 14:38:01,060 [-] [vfs-Worker-2]  WARN FaultHandler ERROR_DETAIL : org.apache.synapse.SynapseException: Unexpected error during sending message out

2 个答案:

答案 0 :(得分:3)

如果您只需要传输文件,可以使用wso2 esb vfs的流媒体选项。

http://mrmalakasilva.blogspot.com/2016/03/streaming-large-files-using-wso2-esb.html

答案 1 :(得分:0)

在顺序中,您可能需要设置OUT_ONLY属性才能使其正常工作。 (可以解释in this blog post

<property name="OUT_ONLY" value="true"/>

如果要进行非阻塞同步调用,也可以使用调用介体。 例如:

<inSequence>
            <property name="OUT_ONLY" value="true"/>
            <call>
               <endpoint name="ftpEndpoint">
                  <address uri="vfs:ftp://{user}:{pwd}@{host}/{directory}"/>
               </endpoint>
            </call>
      ...
</inSequence>