Monday Aug 10, 2015

Scriptable MFT: The Ginsu Knife of MFT Callouts

Overview?

Scriptable File Transfers are "Groovy", or Node or Python, batch files or plain ole boring Bourne shell scripts invoked by the MFT runtime server. Maybe you want to maintain a library of custom callouts, java code or manage moving them from one environment to another? No problem, use the Ginzu knife of callouts to extend MFT, the Run Script Pre-Processing callout now available on the MFT OTN page at bit.ly/learnmft. This baby can do it all, file processing, add new endpoints, enable REST, notify or validate. Got your attention, read on for more details or if you're already sold, just click the link to download and open the README file.

Use Cases

I hate repeating myself but there is virtually no limit to what can be done with this tool but before we blogstorm on this topic, lets briefly review MFT Java callouts from previous blog entries and the official Oracle MFT 12.1.3 documentation. To create a callout from scratch, you have these 6 basics steps.
  1. Create code
  2. Create XML defintiion
  3. Compile
  4. Import
  5. Copy jar to disk
  6. Test

Not really that painful for the DIY types but to use RunScript, you can skip the 1st 3 and just do import, copy and test.

  1. Import Sample Transfer
  2. Copy the jar (as described in the readme)
  3. Test basic scenarios

Internal Processing Things Callouts Can Do

  • Rename and Replace file with  different file
  • Reject a file and return an error
  • Update the monitoring dashboard transfer report
    • protocol headers section
  • Duplicate the file elsewhere

Source Pre-Processing

Source pre-processing is triggered right after a file has been received and has identified a matching Transfer. This is the best place to do validation or extend MFT to go grab a file from some external source. There is an FTPGet.sh example in the RunScript download that shows how to do custom FTP commands such a SITE often needed when interacting with mainframes.

Target Pre-Processing

Target pre-processing triggered just before the file is delivered to the Target by the Transfer. This is a good place to send files to external locations and protocols not supported in MFT. RunScript supports retry semantics and if an error is received, it is reflected in the MFT monitoring dashboard where it can be diagnosed or resubmitted.

Target Post-Processing

RunScriptPre can not be invoked for Target Post processing. A separate callout would be required for that. Post Target processing is not suited for file manipulation and is best for notifications, analytic/reporting or maybe remote endpoint file rename.

Parameters

Transfer UI

Once imported and available in the designer, the callout UI supports the following parameters.

  1. ScriptLocation: disk location of script. Ex: test.sh etc...
  2. Parameters: custom parameters to send to the script. Ex: remotehost=jokes.huli.org
  3. UseFileFromScript: CheckBox; TRUE or FALSE. When checked, it will use the file returned from the script.
  4. RetryCount: Number of retries in cases of failure
  5. RetryInterval: number of seconds to wait between retries

Script Parameters

  The following parameters are not enabled in the UI and always sent to the script.

  1. filename
  2. dir
  3. ecid
  4. filesize
  5. targetname (not for source callouts)
  6. sourcename
  7. createtime

Sample Scripts

The following sample scripts are provided in the RunScriptPre zip file.

  1. test.sh: This shows how to parse the parameters shown above and the use of UseFileFromScript to generate and replace the original file with a tar file.
  2. compress.sh: This is a functional script to replace the original file with either a tar or gzip file. It takes the parameter "compress=tar | gzip"
  3. FTPGet.sh: as mentioned above, this should how to do custom FTP commands

Summary

That pretty much it, there are lots of use cases this tool can solve without having to write a single line of java code. The big win is scripts now can be integrated into the MFT designer and run-time monitoring dashboards. Roll up your sleeves, go explore and report back on other creative ways to extend MFT using this handy utility.


About

Find Us on facebook Follow us on twitter Oracle SOA Suite forum
SOA PM team
Welcome to the Oracle SOA Suite team blog. We'll use this site for news and information that did not make it into our official documentation for a reason or another.

Search


Archives
« March 2017
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today