Skip to main content

Hi, I would like some advice please on the best way to have an activity wait for a certain action to occur before proceeding....


My scenario is that i have a process that generates a file which gets read by an external system and this system then produces a response file which i need to read and then proceed based on the contents of the response file... I have no control over the system producing the response file so the only way i know to continue with my process is when the response file has been created in a specific location....


I would like to know what would you suggest would be the best way to have my process wait until the response file has been created and how would i know from a K2 point of view that the response file has been created?


I was thinking of writing something that polled a folder at a certain interval to check if the file was there but just would like some input as to if there might be a better way to go about this.


thanks.

Traditionally the approach you would take is to use an Async Server event.  Basically this is an default server event that through custom code that will typically call another dll, web service or something and pass it a serial number.  The K2 process then waits for a response (similar to a client event).  The other application at some later point in time will call back into the process using the passed serial number to finish that instance and allow the process to continue on.  You have to give the security context that the application is using Server Event permissions at the Process level in the K2 Workspace.


http://help.k2.com/en/KB000272.aspx


Sometimes instead of passing a serial number directly to the application it maybe stored in a database table that the calling application can query on some known data (maybe the filename) to get the correct serial number).


In case you don't know there is a filewatcher class in .Net 4.0 that sounds like you might be able to make use of.   http://www.techrepublic.com/article/use-the-net-filesystemwatcher-object-to-monitor-directory-changes-in-c/6165137


Reply