Customizing MFT with user exits
You can customize the features of Managed File Transfer by using your own programs known as user exit routines.
Managed File Transfer provides points in the code where Managed File Transfer can pass control to a program that you have written (a user exit routine). These points are known as user exit points. Managed File Transfer can then resume control when your program has finished its work. You do not have to use any of the user exits, but they are useful if you want to extend and customize the function of your Managed File Transfer system to meet your specific requirements.
|Exit point||Java interface to implement|
|Source-side exit points:|
|Before the entire file transfer starts||SourceTransferStartExit.java interface|
|After the entire file transfer is complete||SourceTransferEndExit.java interface|
|Destination-side exit points:|
|Before the entire file transfer starts||DestinationTransferStartExit.java interface|
|After the entire file transfer is complete||DestinationTransferEndExit.java interface|
- SourceTransferStartExit(onSourceTransferStart). - PRE_SOURCE Command. - DestinationTransferStartExits(onDestinationTransferStart). - PRE_DESTINATION Command. - The Transfer request is performed. - DestinationTransferEndExits(onDestinationTransferENd). - POST_DESTINATION Command. - SourceTransferEndExits(onSourceTransferEnd. - POST_SOURCE Command.
- The DestinationTransferEndExits is run only when the transfer completes, either successfully or partially successfully.
- The postDestinationCall is run only when the transfer completes, either successfully or partially successfully.
- The SourceTransferEndExits is run for successful, partially successful, or failed transfers.
- The postSourceCall is called only if:
- The transfer was not canceled.
- There is a successful or partially successful outcome.
- Any post-destination transfer programs ran successfully.
Building your user exitThe interfaces to build a user exit are contained in MQ_INSTALL_DIRECTORY/mqft/lib/com.ibm.wmqfte.exitroutines.api.jar. You must include this .jar file in the class path when you build your exit. To run the exit, extract the exit as a .jar file and place this .jar file in a directory as described in the following section.
User exit locations
- The exits directory. There is an exits directory under each agent directory. For example: var\mqm\mqft\config\QM_JUPITER\agents\AGENT1\exits
- You can set the exitClassPath property to specify an alternative location. If there are exit classes in both the exits directory and the class path set by exitClassPath, the classes in the exits directory take priority, which means that if there are classes in both locations with the same name, the classes in the exits directory take priority.
Configuring an agent to use user exits
There are four agent properties that can
be set to specify the user exits that an agent invokes. These agent
destinationTransferEndExitClasses. For information
about how to use these properties, see MFT Agent properties for user exits.
Running user exits on protocol bridge agents
When the source agent invokes the exit, it passes the exit a list of the source items for the transfer. For normal agents, this is a list of fully-qualified filenames. Because the files should be local (or accessible via a mount), then the exit is able to access it and encrypt it.
"<file server identifier>:<fully-qualified file name of the file on the remote file server>"
For each entry in the list, the exit needs to connect to the file server first (using either the FTP. FTPS or SFTP protocols), download the file, encrypt it locally and then upload the encrypted file back to the file server.