'Design Patterns for Java Rest Call Backs

So I have a system that handles approval of requests from other systems over Rest.

With the flow:

  • App2 (Server) process requests and handle approvals
  • App1 (Client) Submit Request to App2 via REST
  • App3 (Client) approvals GUI
  • App1 (Client) Wait for approval in App2 then do something with the request data.

Now the question is what is the best way for App2 to communicate with App1 that it is approved (which could take hours/days) and that App1 can continue to process the data.

(Note: Long term there can be more than one App1)

Potential solutions

  • Rest Callback: (When App1 makes the request it tells App2 where to send the rest call once approved)
  • MQ/AWS SQS: Some kind of queue that App2 posts approvals onto for App1 to pick up
  • Polling: App1 polls App2 every 10 seconds to see if its request has been approved.

does not need to scale much, based on just a few requests to max 100 per day for argument sake. so not large frequency of data –

Would like to get accepted good practice design patterns on which is best or if there is a better technique as they must be an standard way of doing this that is effective and good.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source