I am looking for a best practise when connecting a web application (a React single page app for example) with pure event based backend (microservices, ActiveMQ for example).
When I do a GET call from React (which is request response), how do I get the response considering all backend services are event based?
My thoughts are:
- Execute the GET command
- Have a REST controller service in the backend (request-response) which fires an event and returns back a response that everything went ok
- On the client side, the signal is caught, but nothing happens, just keep loading
- Event is processed meanwhile in the backend, which fires another "response" event when done, to which (using stickiness or similar approach) the same REST controller listens
- The controller sends the actual response to the browser, using websockets (or similar)
- Browser gets the response, display the results
I know there are workarounds, but I am looking for the best event-based solution.
Aucun commentaire:
Enregistrer un commentaire