Oracle Managed File Transfer (MFT) provides several functionalities aimed to manage and coordinate the transfer of files in a SOA environment. A file transfer in MFT involves three elements: a source, a target and a transfer. The source is the entity from which the file originates and the target is the destination of the file. The transfer defines the transmission of a file between a source and one or multiple targets. Similar as with B2B, MFT allows the definition of custom actions – also called callouts – that can be executed during the transfer flow. These custom actions can be defined at the source and will be executed right after the file is received and processed by MFT. They can also be defined at the transfer and will be executed before sending the file to the target or after the target received the file successfully. The following example will show how to define source and transfer processing actions. Here is a list of the steps that are required in order to implement an MFT callout:
- Callout development
- Callout definition file
- Callout registration
- Callout attachment
As mentioned above, callouts can be defined at three different stages. The first stage is right after the file is received in MFT. This type of callouts are attached directly to the MFT source. The second stage is right before sending the file to the target and the third stage is when the message was transferred to the target. This last two type of callouts are attached to the MFT transfer component. Figure 1 shows these callouts in the transfer process.
The source processing callout and the target pre-processing callout have to implement the PreCalloutPlugin interface whereas the target post-processing callout has to implement the PostCalloutPlugin. The main difference between these two interfaces is that the PreCalloutPlugin defines methods that can be overridden in order to alter the contents of the file being transferred while the PostCalloutPlugin only provides read access to the message.
There are three libraries (jar files) that need to be referenced in order to compile and execute the callouts: oracle.mft.client.jar, oracle.mft.bc.jar and Core-18.104.22.168.jar. These libraries can be found inside the <MFT_HOME>/modules directory.
Accessing the message requires different objects depending on the type of the callout. The source processing action can access the message by casting it to an oracle.tip.mft.bean.SourceMessage. Target pre-transfer callouts need to cast the message to oracle.tip.mft.bean.Instance and Post-transfer callout need to cast the message to a oracle.tip.mft.bean.TargetMessage. All this objects implement the MFTMessage interface that provides access to the metadata values of the message. Here are some samples that show how to access the message at the different stages:
Source processing action:
Target pre-processing action:
Target post-processing action:
Callouts have to be packed in a jar file and copied into the callout destination folder. The default location of the folder is <DOMAIN_HOME>/mft/callouts. A jar can contain one or several callouts.
Callout definition file
Callouts are deployed into the MFT server by using a callout descriptor file. This file is an xml that defines the kind of callouts being deployed and their respective location.
Callouts are installed into the MFT server by using WLST. Following steps show how to install the callouts. It is important to mention that jar(s) containing the callouts has to be copied into the MFT (as mentioned in step 1) before installing the callout.
- cd <MFT_HOME>/common/bin
- . ./setWlstEnv.sh
- wls:/offline> connect(‚weblogic‘,’welcome1′,’t3://localhost:7001′)
- wls:/base_domain/serverConfig> crtCalls(‚/tmp/myCalloutDefinitionFile.xml) //myCalloutDefinitionFile.xml was the file defined in section 2
Now that the callouts are registered in the MFT server, they can be attached to a source or to a transfer, depending on the “group” name that was used in the callout definition file. Callouts are attached using the MFT console
Bonus track: listing and deleting Callouts
MFT provides other WLST functions that can help administering the Callouts.
With listCallouts it is possible to list the actual active callouts:
The function deleteCallout, deletes a specific callout giving that it is not currently associated to a source or a transfer. Sample
deleteCallout(‚Post transfer event generator‘). It is important to mention that callouts that are currently active cannot be deleted. They have to be detached first in order to be eliminated from MFT.