moveToDirectory FTP错误-Mule
使用Mule EE,我有以下项目moveToDirectory FTP错误-Mule,mule,mule-studio,mule-el,Mule,Mule Studio,Mule El,使用Mule EE,我有以下项目 <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:jdbc-ee="http://www... <smtp:gmail-connector name="gmail" doc:name="Gmail"/> <db:mysql-config name="MySQL_Configuration" host="localhost" port="330
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jdbc-ee="http://www...
<smtp:gmail-connector name="gmail" doc:name="Gmail"/>
<db:mysql-config name="MySQL_Configuration" host="localhost"
port="3306" database="dbflow"
doc:name="MySQL Configuration" user="user" password="Pass"/>
<data-mapper:config name="CSV_To_XML" transformationGraphPath="csv_to_xml.grf" doc:name="CSV_To_XML"/>
<ftp:connector name="FTP" pollingFrequency="1000" validateConnections="true" moveToDirectory= "C:\Users\User\Desktop\output" doc:name="FTP"/>
<flow name="dbFlow1" doc:name="dbFlow1">
<ftp:inbound-endpoint host="localhost" port="21" path="/{path}" user="username" password="pass" responseTimeout="10000" doc:name="FTP" connector-ref="FTP"/>
<data-mapper:transform config-ref="CSV_To_XML" doc:name="CSV To XML"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<foreach collection="#[xpath('//info')]" doc:name="For Each">
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<db:insert config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[INSERT INTO `dbflow`.`user_table`
(`my_date`,
`serialnumber`,
`gender`,
`fullname`,
`email`,
`mobilenumber`,
`address`)
VALUES
(#[xpath://date],
#[xpath://serialnumber],
#[xpath://gender],
#[xpath://fullname],
#[xpath://email],
#[xpath://mobilenumber],
#[xpath://address]
);]]></db:parameterized-query>
</db:insert>
<message-properties-transformer scope="invocation" doc:name="Message Properties">
<add-message-property key="count" value="#[flowVars.counter]"/>
</message-properties-transformer>
</foreach>
<logger message="Number of records #[flowVars]" level="INFO" doc:name="Logger"/>
<smtp:outbound-endpoint host="smtp.gmail.com" port="587" user="user10%40gmail.com" password="pass" connector-ref="gmail" to="user2@gmail.com" subject=Muleapp" responseTimeout="10000" doc:name="Email"/>
</flow>
</mule>
mytest.csv的内容如下:(DB same columns和serialnumber是主键)
我已尝试使用#[message.inboundProperties.originalFilename]
和outputPattern=“#[header:originalFilename]”
。也许这些都是错误的,但无论如何,骡子一直显示相同的错误,没有任何改变
关键是将文件从FTP移动到本地PC,然后将其插入DB,然后发送电子邮件。(两条路在一起)。
任何帮助都将不胜感激 您没有显示您在
moveToDirectory
中使用的值,但是,从异常情况来看,您似乎试图移动到本地目录,这将是一个错误
moveToDirectory
的要点是将文件移动到远程目录,而不是本地目录
如果您想要从FTP下载文件的本地副本,只需使用
文件:outbound endpoint
将其写入您想要的任何本地目录。我也开始做类似的事情,我在Studio和Standalone 3.50中完成了一个工作正常的项目,当我将相同的.zip
部署文件移动到3.51时,它开始从文件:入站端点
的移动到目录
(我的已处理/存档目录)中提取文件
在文件上获得的锁:
\\fsvr\vol2\DCH_ESB_Test\LMS\In2\Processed\LMS_20140821_112625_250.dat
\\fsvr\vol2\DCH_ESB_Test\LMS\In2\Processed\LMS_20140821_112625_265.dat
在文件上获得的锁:
\\fsvr\vol2\DCH_ESB_Test\LMS\In2\Processed\LMS_20140821_112625_250.dat
\\fsvr\vol2\DCH_ESB_Test\LMS\In2\Processed\LMS_20140821_112625_265.dat
它应该从以下位置提取文件:
\\fsvr\vol2\DCH_ESB_Test\LMS\In2
相反,它将他们从:
\\fsvr\vol2\DCH_ESB_Test\LMS\In2\Processed
因此,我的应用程序也开始通过我的每日确认邮件,通过我的档案向我发送垃圾邮件。奇怪的是,在3.51上表现不好的zip文件在3.50上工作。当然,在将其释放到野外之前,在Mulesoft就已经发现了这一点。我能想到的唯一一件事是,在流程结束时,我也在使用FTP组件。不知道,但我确实知道,把它调低到3.50会使它正常工作。好的。真棒+1!但是如何将文件与其他组件一起使用?
已弃用。另外,当我尝试使用文件出站时,文件被移动为.dat文件,而不是原始文件那样的.csv文件。是否有任何配置要添加到文件:outbound endpoint?提前谢谢!您不需要全部:您应该能够将文件:outbound endpoint
直接放入您的流中。是的,您可以控制写入文件的名称。请参见《用户指南》中的outputPattern
:好吧,它似乎正在工作,但没有停止:'(Mule一直在无限次地执行相同的操作,直到我手动停止它!我收到33封电子邮件:3,DB表即将满:D,文件名太长(我现在无法删除文件:O)。请告诉Mule只执行一次此过程?!这没有意义:是否正确配置了moveToDirectory
?是否看到文件从拾取目录移动到moveTo目录?否,我已删除moveToDirectory
,因为我希望将文件移动到本地PC。我添加了:
我添加了它位于FTP:inbound endpoint
之后,文件从FTP移动到本地PC(但名称为无穷大),数据插入DB(无穷大记录),我收到电子邮件(无穷大电子邮件):'(