When submitting a managed transfer request to an IBM MQ Managed File Transfer (MFT) agent, one of the parameters you can specify is the source disposition (-sd). This parameter indicates what should happen to the source for a transfer item once the managed transfer has completed. The parameter takes one of two values:
- Leave – If the transfer item has been transferred successfully, leave the source file.
- Delete – Delete the source if the transfer item has been transferred successfully.
Something that comes up every so often is “My managed transfer contains multiple transfer items. When is the source disposition for those transfer items processed – is it after each individual item has been transferred, or at the end of the managed transfer?”
The answer is “at the very end of the managed transfer”.
During a managed transfer containing multiple transfer items, the source and destination agents will process each transfer item sequentially. For example:
- Transfer item 1 will be processed first.
- When the agents have finished with Transfer item 1, they will move onto Transfer item 2.
- And so on.
After all of the transfer items have been processed, the source agent will look at each item in turn, to see if it was transferred successfully or not. If the transfer item was successful, then the source agent will process the source disposition for that item. However, if the transfer item failed for some reason and could not be transferred, then the source agent will ignore the source disposition for the item and leave it.
Here is an example that shows how this works.
Let’s suppose that I have a managed transfer that contains the following transfer items:
|Source Transfer Item||Destination Transfer Item||Source Disposition|
|C:\Input\File A||C:\Output\File A||Leave|
|C:\Input\File B||C:\Output\File B||Delete|
When the managed transfer runs, the following sequence of events occurs:
- The source agent contacts the destination agent, to check if it is OK to participate in the managed transfer.
- The destination agent sends a message back to the source agent, indicating that it is good to go.
- Now, the source agent reads the data contained within
C:\Input\File Aand sends it to the destination agent.
- The destination agent receives the file data, and writes the destination file
- After the file has been written, the destination agent sends back a message to the source agent, informing it that
File Ahas been processed without any errors.
- The source agent receives this response, and marks the first transfer item as “Successful”.
- Next, the source agent reads the data contained within
C:\Input\File B, and sends this to the destination agent.
- The destination agent receives this file data, and tries to write the destination file
C:\Output\File B. However, the destination file already exists.
- As a result, the destination agent sends a message back to the source agent, indicating that
File Bcould not be processed.
- When the source agent receives this message, it marks the second transfer item as “Failed”.
- As there are no more transfer items, the source agent now processes the source disposition.
- As Transfer item 1 was successful, the source agent checks the source disposition for this item. The source disposition is set to “Leave”, so the source agent leaves the file on the file system.
- The source agent now checks Transfer Item 2. As this Transfer Item failed, the source agent does not process the source disposition for it and does not delete the file.
- Finally, the source agent marks the managed transfer as “Partially successful”.
And that’s it. Nice and straightforward.
As always, I hope this helps! If you have any questions on this, let me know and I’ll be happy to answer them.