You need to sign in to do that
Don't have an account?

Calling apex in every 3 seconds.
Hi Everyone.
We have a requirement in salesforce where i need to communicate with other system using API -- which is not a problem .
But the problem is the other ther system is very old and it can handle only one requests in every 3 seconds. So i cant sent multiple requests in one go.
So did any body has done anything like those before?
I know following options, but none of them meet our requirements:
1) Using VF page and Actionpoller. But this need VF page to be open all the time & doesnt meet our requirements. we want more dynamic and reliable.
2) Introduce delay in apex code by usign dummy for loop to run for random times - This is not good way & we are more likely to hit the script statments limit .
4) I can use the apex schduler but salesforce gives flexibility to run every hour not every min. :( So i need to send atleast 60 requests in every hour, even this fails to meet our requirment.
3) Use Cronkit app - As we are already use it for other functioanlity. I am not sure how best it can be used. Can any one please answer my following basic fuction:
a) As of now we use cornkit to implement one class to execute every 15 mins . So can i create one more cron batch in the same org to execute one more class??
b) What minimum frequency can i set up a cron batch, Can it be as low as 1 min. ?
c) present bacth with is supposed to run every 15 min runs some wherre around 25 min , so adding one more cron bacth would have any impact on the exisiting ones or the new ones?
If any one has implemented any thing of this sort of requirement, please share your thoughts.
Thanks
Ashok
Hi You can use Schedule Apex,
See below example, which is calling after every 1 min (you can change it to 3 sec).
You need to call only once, then apex will schedule next call automatically.
Regards,
Satish Kumar
Hi Panchal,
Your code works fine for minute but the same code doesnt work when i use it for seconds. unfortunatley..
I am using this code for 1 min. I tried it for second but its not working. :(