How to call REST service every 30 secs to accept an input

How to call REST service every 30 secs to accept an input

  

Hi All,

We have below requirement and need your help in having solutions on how to implement.

Call a REST service every 30 secs automatically and get the projectLockStatus value from the REST service and based on the projectLockStatus value we need to check whether project is locked or not in the application.

Cheers

RajHasti

If u want to call the REST service every 30 seconds you need to use Timers. But that could be a problem from a performance point of view.


Regards,

Marcelo


Hi Rajasekhar,

Have you tried to use an Action associated with a Timer to do that?

  • Add a Timer and associate an Action to it. Set its schedule to when you want the Timer to start (you can also start it in Service Center).
  • The Action would call the REST service, do the necessary logic and schedule the Timer programatically
  • To schedule the Timer programatically you have to access its Entities (Cyclic_Job_Shared and Meta_Cyclic_Job of module System) and change the “Next Run” attribute of the Cyclic_Job_Shared to 30 seconds from the CurrDateTime()

Cheers,

José

EDIT: As Marcelo has said, you could end up with performance problems by calling the Timer every 30 seconds.

José Costa wrote:

Hi Rajasekhar,

Have you tried to use an Action associated with a Timer to do that?

  • Add a Timer and associate an Action to it. Set its schedule to when you want the Timer to start (you can also start it in Service Center).
  • The Action would call the REST service, do the necessary logic and schedule the Timer programatically
  • To schedule the Timer programatically you have to access its Entities (Cyclic_Job_Shared and Meta_Cyclic_Job of module System) and change the “Next Run” attribute of the Cyclic_Job_Shared to 30 seconds from the CurrDateTime()

Cheers,

José

EDIT: As Marcelo has said, you could end up with performance problems by calling the Timer every 30 seconds.

Hi Jose,


Thanks for reply.

The REST service is having input parameter - projectID mandatory field and I am not seeing Timer is having capability to take the project Id from the Application.


Also request you to please provide me sample OML or code to use timer programatically as well as in the Process Timer.Appreciate all the help

Cheers

RajHasti


Hi RajHasti,

You're right, the Timer does not accept parameters.

Where does your projectID comes from? Can't you get it from the database or with some logic? 

Cheers,

José

Hi RajHasti,

Did you solve the issue that you had?

Cheers,

José

José Costa wrote:

Hi RajHasti,

Did you solve the issue that you had?

Cheers,

José


Hi Jose,

I am still working on this.Will be able to check this soon and reachout to you if any help required