Mule - Delete files with Files Connector

假如想象 提交于 2020-01-07 01:49:29

问题


This is my main mule flow:

HTTP > Payload > File (Create) > Property (File Name) JMS

And that JMS calls to other flow that starts with JMS

JMS > JSON TO XML > File (Delete by file name)

Firstly, I create a file with the JSON message.

And finally, when JSON message is transformed to XML, I try to delete the file by name calling a property that tell me the name.

But the files doesn't delete. Its output this action by log:

Writing file to: C:\errors\91fa03a0-dd33-11e5-a0d9-408d5c4c1bf3.dat

How can I do to delete it?

I tried with the option autoDelete in the Connector Configuration but it doesn't delete.

<file:connector name="File1" outputPattern="#[message.inboundProperties.fileName]" autoDelete="true" streaming="false" validateConnections="true" doc:name="File"/>

回答1:


You can't use this file outbound endpoint to delete a file.

If you would use something like S3 for example you can, but those connectors are 'operation-based'.

It's meant to write an new file or append data to an existing one.

The autoDelete option is for deleting the file once it has been read by a file inbound endpoint.

More info: https://docs.mulesoft.com/mule-user-guide/v/3.7/file-transport-reference

If you want to delete and for your usecase you should use a piece of JAVA code and use methods from the File Class: https://docs.oracle.com/javase/7/docs/api/java/io/File.html



来源:https://stackoverflow.com/questions/35668218/mule-delete-files-with-files-connector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!