lion_pankaj
lion_pankaj

Reputation: 160

Http response and request in java related framework like spring, spring boot

I want to stored http request in databases and will generated response to it when required.

Is it possible to stored the http request in db and generate response to it after 1 day or more in spring boot/spring

Upvotes: 0

Views: 379

Answers (2)

Vinh Truong
Vinh Truong

Reputation: 431

Depend on your system requirement, the server can work something like this:

  1. Client send http request to server

  2. Server saves http request (to DB, file, ... anything) and generate a unique request_id. Server returns this request_id to client.

  3. The next day, client will need to send a new http request to server to get the response, with previous request_id included.

  4. Server look for saved request_id, process it, and return response to client.

Upvotes: 0

balaaagi
balaaagi

Reputation: 512

Obviously yes. It is how you architect your system. What I could see is basically you are trying to do something on scheduled manner.

Try using @Scheduled annotation to perform scheduled tasks.

Refer this url

Make sure to have persistent layer which stores the requests and your scheduled tasks pick it up. If it needs to communicate with different systems as call back include it as part of your task.

Upvotes: 1

Related Questions