Suppose I have 2 servers.
The first is a service that provides some computations, which can last long time (minutes to hours).
The second server will use this service to have some data computed.
I’m trying to design a REST API for the first server and so far so good. But I’d like to hear some opinion on how to model notifications when the long lasting task is finished.
I considered 2 approaches so far:
- Polling – the second server will ask every now and then about the result.
- Callback – Second server will setup an uri for the first one to call after it is done. But this smells a bit in REST API.
What do you think?
In addition to what I’ve already answered in this similar question, I’d suggest using the Atom Publishing Protocol for the notification (you could publish to your second server).