How to create a scheduled task

Hello,

i do have a scenario where file will be created in a folder.
I want a scheduler to run periodically to monitor that that folder, if any file gets placed in the folder, then it has to pick up that file and copy it to another location.

Could somebody explain me how to proceed …

thanks in advance

Are you talking about how to build the file processing logic (reading from one directory and moving to other) or only the scheduler part ?

If you are asking only the scheduler part, then Create a flow service in Developer for file processing. Go to the Administrator web page> Scheduler > Create a schedule task> and provide your flow information and schedule details.
Hope this helps!

Thanks a lot. IT worked perfectly fine.
Moreover we came to know from here that, the RUNASUSER parameter has to be sufficed with a valid user name to accomplish this task.

Anyway, thanks Ashish…

Badri

Hello,

I have a similar requirement. Everyday at 9:45 AM a file will be placed in a folder. I need to run a schedule service to run at 10:00AM and process the file. If i could not find the file at 10:00AM then it need to check on every 15 Mins interval till 11:30AM. If the file is not placed till 11:30 then i need to sent email notification.

If the file is loaded in between that time then the scheduler should stop. For example file is placed at around 10:40 and my sheduler had picked the file at 10:45 then the job of the scheduler is over and it should not run again for the day and start next day.

Refering to my previous post…

I’m working on webMethods 6.0.1 version.

Thanks

Uday

If possible, you might consider using the new file polling featues in webMethods 6. If you’re interested in this new capability, let me know–I can send you more details since I can not upload more than a 20K attachment.

Best regards,

  • Shawn W. Szturma
    Systems Engineering

The file polling port will work great for this, but if you want to use a scheduler, then look at the services in pub.scheduler.

You will need two schedulers, the first is a one-time instance as per your description, the second will handle the 15 minute interval for file polling and is suspended. If you do not find the file, then turn on the second by resumeTask. Once the file is found, put it back asleep using the suspendTask.

I’m willing to bet that you can do the same with the file polling port if you research it. The file polling port should be able to be enabled via a scheduler and disabled once the file is found until the next time the scheduler is run.

Ray

Thanks for your response.

Yeah i can use the file pooling feature of WM6. Please let me know the more details on that.

Thanks

Uday

Hi, Shawn (and others).

I just upped the upload maximum allowable size to 35k from 20k. I hope this helps you to help other wMUsers members more effectively.

There will be an official announcement in this week’s Go with the Flow but it sounds like you guys could use the tip now. :wink:

Thanks.

Hi Ray,

Can you be a bit more specific. I have a similiar requirement as Uday’s but I do not have webMethod version 6.0. So I am thinking of using the alternative suggested by you.

What are the two schedulers u suggested we should be using pub.scheduler:addComplexTask and
pub.scheduler:addRepeatingTask.

Thanks a mill

Well, what you could do, if I understand you correctly, is to add some code to your getDocs service such that if it does not find a file, then send email. If I understand you, this service gets run every 15 minutes. If it does not find a file in the directory, then you want notified. So, if empty then send email. Perhaps this is not really how you want it to operate.

Hi Edward
Thanks for your reply.
But there is some mis-communication between us. My getDocs will run after every one minute. I want another check, which will check for non-availability of files for 15 minutes. In case there is no file posted for 15 minutes or getDocs is not able to invoke for 15 minutes I want to send an alert.

Rgds
Prafulla

Hello Praffulla,
I agree with Bhavani. Just use a counter to determine if below 15 counts. If email is sent set a flag that it has been sent then if count is less then or equal to 15 AND flag indicates email HAS been sent then start over in the count ELSE send email.

The Storage Services are well documented in the BuiltInServices. Propose you to go through the same.

Bhavani

Just a suggestion on this old topic, maybe a service that

set timer = 0
LOOP
timer++
if directoy has file
invokeTreaded something
make another schedule of this service to run once
if timer over 15
email
make another schedule of this service to run once
sleep 60 second

This algo is better than two schedule job. Imagine ur processDoc schedule processed over 60 second that means you will receiver email prematurely as 15 minutes might not have enough time to execute 15 processDoc