X

Customizing Oracle MFT with Java Overview

Overview

Oracle MFT was designed so that the most common features are provided out of the box but when that is not enough, it should be easy enough to extend it using small snippets of customizable code. For the self industrious, you can find all that you need to get started in the Oracle MFT documentation section Processing Transfers with Custom Callouts as shown below.

If you want or need a more detailed drill down of this topic then just read on. As a quick review, remember that all custom callouts are totally reusable and parameterized so any development investment you make is generally a one time cost.

Terminology

There are many use cases and types of custom callout we will discuss here involving what the callout can do plus when and how the callout can be invoked but first a little background and terminology. Callouts is a general term that is used to describe custom java code that can be used while configuring an MFT Transfer in the MFT Designer page. MFT provides out of the box "Actions" such as compress/decompress or encrypt/decrypt that are available and like your custom callouts can all be attached by clicking the <add processing actions> button.

For the rest of this article I will use the term Action as it applies to both out of the box actions and custom callouts.

Types

Actions come in 2 general types: those that need to modify the payload and those that do not. The "Newline Conversion" example in the docs illustrates how to modify a file to change the newline character to or from DOS to Unix. Actions such as this need to modify the content and must implement the PluginOutput method which provides an output stream.

    public PluginOutput process(PluginContext context, InputStream input,
OutputStream out, Map<String, String> calloutParams) {

 Actions which do not need to modfy the files contents implement a different version of this method that does not have access to the output stream as shown below.

    public PluginOutput process(PluginContext context, InputStream input,
Map<String, String> calloutParams) {

 Invocation Order

 Actions can be invoked in the following points in a transfer. There are benefits to each we will discuss below.

  1. Source
  2. Pre-Target
  3. Post Target

Source

Source actions are attached on the Source artifact page and are fixed for all files coming in on that channel. If the requirement for the channel is to always include nothing but PGP encrypted files then this is a good reason to add an action to the Source processing. If however, there are different file types being delivered in this channel or folder then it is best to either use a different folder or make use of Target actions.


Pre-Target

Target actions are configured in the Transfer flow page and are executed after any Source actions have completed. To continue with the example above where multiple file types share a single folder, a fan out scenario can be implemented to reuse the same Source using Content Filters in different Transfers to route the different file types to different Targets. In this example, one Transfer would have a Target Decrypt Action while the other would have no actions so the file is routed as is to another Target. This illustrates one way to maintain an archive of the original file while sending the "processed" file to it's ultimate Target for further processing.


Post Target

Like Pre-Target, Post-Target actions are configured in the Transfer. Post Target actions are invoked once the file has been successfully delivered to the Target. For this reason, Post Target actions do not generally modify the contents of a file. Notifications are very well suited for Post Target actions as well as decompress of a zip file with multiple files.

Summary

There are many use cases for actions or custom callouts including compression, encryption, notifications, file payload line conversion, validation etc... that will be discussed in future blogs. With this overview, you should be ready to get on with that first end to end sample that is fully documented in the Oracle MFT documentation section Processing Transfers with Custom Callouts, all 81 lines of code of it.



Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services