骡子文件传输以从 Windows SMB 共享读取文件



我正在尝试将文件写入Windows SMB共享。Mule File Transport 文档说我应该能够访问 Windows 位置,如下所示:file:////192.168.0.1/temp/

这是我的骡子流:我想知道是否有解决方案。谢谢!

<file:outbound-endpoint   responseTimeout="10000" doc:name="File" address="file:////<IPAddress>/ShareName/" outputPattern="hello.xml"/>

我收到以下错误:

Message               : Streaming failed. Could not get output stream. Failed to route  event via endpoint: DefaultOutboundEndpoint{endpointUri=file:////<IPAddress>/ShareName/,    connector=FileConnector
{
name=connector.file.mule.default
lifecycle=start
this=2b1f76e1
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[file]
serviceOverrides=<none>
}
,   name='endpoint.file.<IPAddress>.ShareName', mep=ONE_WAY, properties=  {outputPattern=hello.xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000,   endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type:   String
Code                  : MULE_ERROR-42999
--------------------------------------------------------------------------------
Exception stack is:
1. No such file or directory (java.io.IOException)
java.io.UnixFileSystem:-2 (null)
2. Streaming failed. Could not get output stream. Failed to route event via endpoint:  DefaultOutboundEndpoint{endpointUri=file:////<IPAddress>/ShareName/, connector=FileConnector
{
name=connector.file.mule.default
lifecycle=start
this=2b1f76e1
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[file]
serviceOverrides=<none>
}
,  name='endpoint.file.<IPAddress>.ShareName', mep=ONE_WAY, properties={outputPattern=hello.xml}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type:     String (org.mule.api.transport.DispatchException)
org.mule.transport.file.FileConnector:569    (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.io.IOException: No such file or directory
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at org.mule.util.FileUtils.createFile(FileUtils.java:93)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

当 Mule 在 Windows 操作系统上执行时,使用文件传输访问 UNC 路径时有效。

由于您似乎在Unix机器中,因此您必须使用CIFS/SMB协议。有一个社区支持的模块称为mule-transport-cifs,可以帮助您解决这个问题。

将此模块添加到您的项目后,您应该能够通过将文件出站追逐到类似这样的东西来使用它。

<smb:outbound-endpoint host="<IPAddress>" user="username" password="secret" path="/ShareName" outputPattern="hello.xml"/>

最新更新