My company is planning to use CQRS architecture on our back-end but as a client-side developer I'm a bit confused about how to consume a request. Here are the methods that I came up with, none being ideal from my point of view:
- The server waits until the queue gets processed and gives back the needed data in the response. (sounds like a pretty poor approach from a performance point of view);
- The client makes the request and gets back a "202 Accepted" once the request was added to the queue, than the client uses an interval system to pool until it gets the necessary data from the back-end (I'm not a big fan of doing X http request every second);
- Web Sockets ... seems like the perfect solution as the server would be able to push the data to the client once it was processed (I'm a bit concerned about having thousands of sockets opened around the entire app).
So the question is: What is the best approach to this problem? (not necessarily one of the above)