0
votes

Is this possible to have Mule perform a SFTP Invoke mid of the flow. I have a requirement to read files at a specfic time during the day. I am noticing there are examples for Quartz Polling Job but noticing there is a limitation to only read 1 file. I am looking for a SFTP activity to read files following a certain pattern. Any direction to this will help.

Noticing Mule only allows inbound or outbound endpoint.

Thanks

2
Adding a SFTP endpoing midway is throwing a error. Indicating SFTP is exopecting a input. While i want SFTP to create a connections and generate flows behaviour based on message inputs. mep=REQUEST_RESPONSE, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: NullPayloadSanSharma
Is this a limitation. Adding SFTP, SFTP midway expects a payload. I added a String to the event generator job. Now the payload is generating as files on the destination. <quartz:inbound-endpoint jobName="Demo" cronExpression="* 0/1 * * * ? *" doc:name="Quartz" connector-ref="QuartzConnector"> <quartz:event-generator-job> <quartz:payload>dummy</quartz:payload> </quartz:event-generator-job> </quartz:inbound-endpoint>)SanSharma
Adding any file endpoint in between will work as outbound endpoint, so it expects payload for file writing.AnupamBhusari
I am exploring MuleRequestor. Have imported that to Anypoint studio. However there is still a learning curve. 1 for example files are not getting removed from SFTP. How to achiev this without requestor. Again I need to invoke SFTP using scheduler. Read files from a location at specific point in time. Any help will help.SanSharma
Hi anupam. Adding SFTP mid flow generates following error Root Exception stack trace: java.lang.IllegalArgumentException: Unexpected message type: java.io.InputStream, byte[], or String expected. Got org.mule.transport.NullPayload. indicative of Mule expecting a input. While i just want it to perform a fetch and not submit.SanSharma

2 Answers

3
votes

You can use Mule Requester Module for getting resources in between the flow. Details can be found at Mule Requester Module

Refer following code for scheduling flow to retrieve files from SFTP location

    <flow name="testmappingFlow2">
        <poll doc:name="Poll">
            <schedulers:cron-scheduler expression="0 0 0 * * ?"/>
            <logger message="Sheduled job invoked" level="INFO" doc:name="Logger"/>
        </poll>
        <!-- Your flow logic goes her  -->
        <mulerequester:request-collection config-ref="Mule_Requester" resource="{sftp.resource}" count="10" doc:name="Mule Requester"/>
        <!-- Your flow logic for processing files. above code will return 10 files at time.   -->
    </flow>

Hope this helps.

0
votes

Using Mule Requestor has worked. Thanks Anupam.