Hi, We have an interface where EDI file has to be picked up from FTP server and process it further through TN. We have a process model created which will get initiated on receipt of EDI Doc in Trading Networks server.
When a polling service posts the EDI data read from FTP location to TN using “wm.tn.receive”, the process is getting invoked synchronously and the polling service has to wait for the whole process to complete.
Do we have a way to asynchronously invoke the process model for a TN doc? How can we achieve that?
If we don`t have a direct way then we were planning to invoke a service for the TN doc using processing rule, which will publish the doc to broker and process model will be triggered for the broker doc instead of TN doc.
One of the ways: create a publishable document with fields that you need for the process, like internal doc id, process name, sender, receiver etc. Design the process first step to subscribe to this document instead of a TN document.
In the service invoked by the processing rule, fill this document with details from TN and publish it. (You can do it from polling service also… with modifications)
A technique I’ve used in the past for just this reason (holding the FTP connection open during de-enveloping can be bad) is to initially “hide” the real type of the document from TN.
Poll for the EDI docs.
For each document, set the tn_parms to indicate that the document type is just some flat file. Perhaps named “Staged EDI” or something. Do not pass the data as edidata.
In the processing rule, set it to run async. TN will persist the document and then return to the caller. So your polling service will have successfully saved the document, and nothing more, and then return success to the FTP connection.
The async rule will invoke a service on a new thread. The job of this service is to simply submit the document to TN, this time as edidata so that TN will do the de-enveloping, process each item, etc. kicking off processes as configured.