I invoke a flow service through schedulers every 1 hr. The flow service would grab some files, process them move the files.
If a second scheduler kicks off before the earlier one is done, it picks up the files second time since the files were not yet moved by the earlier process.
Is there any process in webMethods which would help us to identify if a particular flow service is running, so that the second scheduler would kick off only when the earlier service is done with execution else it would abort.
Are there any other ways, to stop the invoking of flow service, if one instance is already running.
Thanks in advance.
Your better off setting up a three directory group. One for inbound where you place your initial documents, a second for those documents being worked on, and the final for the completed documents. This way when the first service kicks off, it will immediately move the file to the waiting folder where no other service will interfere. Since it knows the file name, it will not try to work on any other file. Your next service will only see to inbound folder where all files there are not being used.
This will also help in that if a service fails, the file will be in the holding area for you to return it to the inbound folder.
So to recap:
inbound -> hold -> outbound
service1 will take file immediately to hold, service1 will use file name to work on only the one file, service1 will finish by placing file in outbound.
If I were you, I’d utilize the filepolling port. You configure this under Security_Ports, Add a port.
One of the settings is to process via file age (seconds) if it is a timed event. Otherwise, activity will occur whenever a file is placed in the directory. You can set working directories, error directories and finished directories (where the file is moved once processing is complete.)
As far as your scheduler is concerned, I assume it is a repeating task with a simple interval of 3600 seconds (1 hour). If this is the case, just check the box “Repeating”, “Repeat from end of invocation.”
This will insure that only one thread operates at one time and thus, you will not grep the same file names by two separate processes.
The file polling concept works good, if the file polling directory is on the same server. In my process the source directory of the files is a different than the one of webMethods.
Secondly, We need to run the schedulers every one hour.
You can mount a networked directory with the file polling port by specifying \NetworkDirectoryPath.
As far as scheduling, the file poller wasn’t designed to work that way.
I’ve had to do the same thing prior to the creation of the file polling ports.
I have a java service that greps a directory and retrieves a string array of file names that can be passed to a processing service.
You can create the same easily enough. Also, you can create move, delete and copy file services to put the files in working, error or complete directories.
For the scheduler, take a look at the checkbox so that you are only intiating one thread at a time.