In a previous post, I discussed how MOND simplifies the common tasks associated with FTP/SFTP/FTPS integration. In this post, I will discuss the different steps along with snapshots to show how complex integration tasks can be completed in a few hours using the browser and a few configuration entries.
To start with, login to MOND cloud, go to the Build tab and choose the channels options under the Communications section. Depending on your trading partner's FTP server type, choose the appropriate Channel Type.
If this channel is going to be used for read only operations, choose "Read"from the Send/Receive drop down. If it is going to be used for read and write ,choose "Receive and Send" from the drop down.
Based on these, you can also set the read directory(default directory from where the files will be read), the write directory(the default directory where your files will be stored) and also an archive directory.
Archive directory is an optional setting. Sometimes, once the file is read and processed, you want it to be to stored in a backup folder on the same FTP server. In such scenario's, backup can be done without any coding by just setting the archive directory.
For more complex operations, where you may want to move do a different FTP folder based on some conditions, just set your home directory as the read or write directory. Within the mapping rules section, you will be able to use this channel and change the directory to any needed directory.
Choose the name of the FTP channel carefully. Why is the name so important?
This is because you can define any number of FTP channels with the same name, but for a different trading partner.
For example, you can define many FTP Channels called 'FTP-Read', but with different host names, trading partner names etc for Walmart,Costco, Macy's, Target etc.
In the mapping rules, you can create a map to read all files from the channel called 'FTP-Read', store them in the MOND Datastore and delete them.
You can define multiple schedulers, and in each scheduler,invoke the same map for a different trading partner.
When the scheduled map runs for Walmart, MOND will connect to the Walmart FTP server and read the files, when the same scheduled map runs for Target, or its vendors, it will connect to their FTP servers and pull the files.
This way, you can use the same business logic, but for different trading partners.
You can also choose the retry attempts, retry interval and the retry factor. For example,you can choose 5 attempts, 30 seconds and retry factor as 2.
This means,progressively MOND will attempt to retry after longer time intervals and hopefully pull all the files within these attempts.
If not, you can choose an email channel that will be used to send the error email notification.
Next, lets see how to use this channel in a mapping rule.
The operator "FTP Directory Listing",connects to the selected FTP Channel (based on trading partner if required) and gets a list of files in the 'read directory' of the channel. The count of files found in this directory is stored in a temporary variable called $fileCount. Note that the files are not read at this stage. Also you do not have to connect to the FTP server, or disconnect from the FTP server. All these are handled internally by MOND.
We then loop over the variable $fileCount and use the operator "Read FTP File". The file is actually read now. In case of any FTP error, the actual error code returned by the FTP server will be stored in the temporary variable "$mondFTPResponseCode". In case of success,this variable will have "200".
You can choose to send a custom email, by using the"Send Email" Operator, either in case of success(ex: FTP file received notification) or failure(ex: FTP Read error).
Once the file is read, we can do several things. We could just store the file in the MOND Datastore, or we could store and then invoke a routing rule or use the operator "Debatch and store".
For EDI/X12 documents, this operator stores the original batch document and the individual documents in the batch as MOND documents.
For example,if the EDI Batch document has 500 individual documents, this operator stores 501 documents. For the individual split document, MOND maintains a reference to the batch document. This way, business users and technical support team can login to MOND Cloud and see the batch document and all related documents in a hierarchical tree.
Once the document is debatched and stored in the MOND Datastore, it can be deleted from the FTP server. Note that this takes care of'ACID' properties. If there is any error in debatching (for ex: there is a database issue after splitting and storing 50 documents out of 100), the entire operation will be rolled back.
For very large batch files (with more than 5000 transactions), an intermediate commit is issued after every 100th document.
What if the Inbound document is actually a 997 (Functional Acknowledgement)?
Well, the 'Debatch and store' operator is an intelligent operator. If the document received is an EDI 997, it goes back and searches the MOND Datastore for the referenced documents. It then updates the status of the original documents as 'Acknowledgement Received' and based on the 997 status,sets the original document's status to 'Accepted', 'Rejected', or 'Partially Accepted'. What if the referenced document does not exist within the MOND Datastore? Since we cannot send a 997 for a 997, an email is sent to the support team in case the referenced documents do not exist, or if the document status is not 'Accepted'.
After the FTP file is deleted, the next job can be invoked asynchronously from this job. Depending on the requirements, the next job could be to transform these documents into another format, or to simply send it to some one else.
Finally, this same map can be scheduled to be run at same or different frequencies for all trading partners. This of course results in an as many scheduled jobs as there are trading partners. There is another method, where it is possible to have one scheduled job, that in turns calls the same map for different trading partners.
I hope I have shown, how with just a few operators (Directory Listing, Read FTP File, Debatch and store and Delete FTP File), we can create very powerful maps. This simple, but extremely powerful concept is being used by our customers every day to pull large and small documents from AJ Madison,Ashley Furnitures, DBSchenker, Denver Mattress, Shop NBC, Simmons, Forward Air, Overstock, Walmart, Cinram, Serta and more...