6 ms·
> The typical action sequence is the user submits a request via the web application and the backend handles that message by adding a message to RabbitMQ. The co
by codedokode 4y ago
> The typical action sequence is the user submits a request via the web application and the backend handles that message by adding a message to RabbitMQ. The consumer gets the message and makes a HTTP call to another web service to actually submit the request. From there, the polling logic takes over and subsequent messages on the queue each represent a polling attempt to retrieve the results. If a job has no results, the consumer places a message back on a queue so we can delay the next polling attempt by a (customer configurable) amount of time.
This looks like an overengineering to me, unless I have missed something. For example, I don't understand this part: "the consumer gets the message and makes a HTTP call to another web service" - why cannot that web service pull the message directly?
I would implement it like this: when a client submits a request, it is added into an SQL database, and RabbitMQ is used only to notify the consumer. The client gets back a secure Job Token that it can use for polling to get the status of the job. The consumer reads the job from the database, executes it and updates status in the database. The client uses polling to know when the job is done.
Of course, if you don't like polling, then you can use a WebSockets daemon that would notify a client when the job is done.
- Denvercoder9 4y ago> why cannot that web service pull the message directly? It could e.g. be an external service run by a third-party, or an off-the-shelf service that's hard to add integration to, etc.
- codedokode 4y agoIndeed, I didn't think about that.