Keith Park
Keith Park

Reputation: 617

Get data from other RESTful Server and save DB in Spring

Most of cases, views(JSP) use RESTful server to extract desired data.

In my case, a wep application server itself needs to extract data from other web server which provides RESTful. And it needs to periodcally update data into database without users request.

As far as I know, Web Application Server is in operation when there is a requst by a user. If it is difficult in implementing through scheduling, would you recommand to use the following method?

  1. A user requests by specific URI
  2. A view is shown which telling user for a wait.
  3. A controller gets initial information from DAO(Persistance/Service class)
  4. A controller(it may be the other type of class) requests data from other RESTful server using the initial information as parameters
  5. A controller receives data and stores into databases by using DAO
  6. A controller sends messege to a view for telling the task has been done.

System / Framework dependency : JSP, Spring-MVC, Tomcat

Thank you in advance, any advice will be very helpful

Upvotes: 0

Views: 151

Answers (3)

Fahad Sheikh
Fahad Sheikh

Reputation: 26

There are certain number of ways which can fit into this scenario as a solution :

  1. Ticketing - Depending upon the usecase we can integrate a ticketing system like serviceNow, Remedy and ITSM into the application and schedule the operation. Involves concept like Polling.

  2. Using @Scheduled annotation to schedule the tasks which are to be implemented "schedule-tasks-ref"

Please feel free to ask if you want any clarification on this or else you have usecases that are not met by these solutions offered.

Upvotes: 0

Justinas Jakavonis
Justinas Jakavonis

Reputation: 8838

Quartz Scheduler (http://www.quartz-scheduler.org/):

Quartz is a richly featured, open source job scheduling library that can be integrated within virtually any Java application

Some examples at Quartz Scheduler Tutorial

Upvotes: 0

rorschach
rorschach

Reputation: 2947

Spring has a whole Task Execution chapter on handling this use case by creating @Scheduled tasks.

Upvotes: 2

Related Questions