Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The file endpoints are resource based endpoints (such as ftp and sftp endpoints) as opposed to event based endpoints (i.e. jms and vm) or tcp based endpoints (i.e. tcp, http, udp, etc)</p> <p>For this reason the approach you are implementing won't fit your use case. If you need to load a file on demand (i.e. when you hit an http endpoint) you should refactor your flow and use the <a href="http://javaduke.github.com/mule-module-file-utils/mule/fileutils.html" rel="nofollow">mule-module-file-utils</a>. This module need to be added as a maven dependency or installed in Studio. You can do that by cloning the <a href="https://github.com/javaduke/mule-module-file-utils" rel="nofollow">git repo</a> and then you can install the generated update site zip file following <a href="http://www.mulesoft.org/documentation/display/MULE3STUDIO/Additional+Cloud+Connectors" rel="nofollow">these instructions</a></p> <p>Once you did that your flow will look like the following:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;mule xmlns:fileutils="http://www.mulesoft.org/schema/mule/fileutils" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/fileutils http://www.mulesoft.org/schema/mule/fileutils/3.3/mule-fileutils.xsd http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd "&gt; &lt;fileutils:config name="Fileutils" doc:name="Fileutils"/&gt; &lt;flow name="FileCopier" doc:name="FileCopier"&gt; &lt;http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="copy-file" doc:name="HTTP"/&gt; &lt;scripting:transformer doc:name="Script"&gt; &lt;scripting:script engine="Groovy"&gt; &lt;scripting:text&gt;&lt;![CDATA[def dir = new File("/" + message.getInboundProperty('http.relative.path')) log.info(dir.getPath()) return Arrays.asList(dir.listFiles())]]&gt;&lt;/scripting:text&gt; &lt;/scripting:script&gt; &lt;/scripting:transformer&gt; &lt;logger level="INFO" doc:name="Logger"/&gt; &lt;set-variable variableName="fileNumber" value="#[payload.size()]" doc:name="Variable"/&gt; &lt;foreach doc:name="Foreach"&gt; &lt;fileutils:copy-file config-ref="Fileutils" destinationName="#[message.payload.getName()]" destinationPath="/tmp/out/" fileName="#[message.payload.getName()]" filePath="#[message.payload.getParentFile().getPath()]" fileAge="0" doc:name="Fileutils"/&gt; &lt;/foreach&gt; &lt;set-payload value="#[flowVars['fileNumber'] + ' file copied']" doc:name="Set Payload"/&gt; &lt;http:response-builder status="200" contentType="text/plain" doc:name="HTTP Response Builder"/&gt; &lt;/flow&gt; &lt;/mule&gt; </code></pre> <p>If you don't want to use the fileutils module you can replace it with a scripting component that implements the file copy logic</p> <p>Now this flow can be invoked using the following curl command</p> <p>curl http://${hostname}:8081/copy-file/${path_to_directory_to_copy}</p> <p>The documentation about curl is available <a href="http://curl.haxx.se/docs/manpage.html" rel="nofollow">here</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload