Specify programs to run with MFT
We can run programs on a system where a Managed File Transfer Agent is running. As part of a file transfer request, we can specify a program to run either before a transfer starts, or after it finishes. Additionally, we can start a program that is not part of a file transfer request by submitting a managed call request.
There are five scenarios in which we can specify a program to run:- As part of a transfer request, at the source agent, before the transfer starts
- As part of a transfer request, at the destination agent, before the transfer starts
- As part of a transfer request, at the source agent, after the transfer completes
- As part of a transfer request, at the destination agent, after the transfer completes
- Not as part of a transfer request. We can submit a request to an agent to run a program. This scenario is sometimes referred to as a managed call.
The order, in which the user exit and program to run during a transfer request, is as follows:
- 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.Notes:
- The DestinationTransferStartExits 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.
There are several ways to specify a program that we want to run. These options are as follows:
- Use an Apache Ant task
-
Use one of the fte:filecopy, fte:filemove, and fte:call Ant tasks to start a program. Using an Ant task, we can specify a program in any of the five scenarios, using the fte:presrc, fte:predst, fte:postdst, fte:postsrc, and fte:command nested elements. For more information, see Program invocation nested elements.
- Edit the file transfer request message
-
We can edit the XML that is generated by a transfer request. Using this method, we can run a program in any of the five scenarios, by adding preSourceCall, postSourceCall, preDestinationCall, postDestinationCall, and managedCall elements to the XML file. Then, use this modified XML file as the transfer definition for a new file transfer request, for example with the fteCreateTransfer -td parameter. For more information, see MFT agent call request message examples.
- Use the fteCreateTransfer command
-
We can use the fteCreateTransfer command to specify programs to start. We can use the command to specify programs to run in the first four scenarios, as part of a transfer request, but we cannot start a managed call. For information about the parameters to use, see fteCreateTransfer: start a new file transfer. For examples of using this command, see Examples of using fteCreateTransfer to start programs.
Parent topic: Developing applications for Managed File Transfer