Consider a real-time application where a web-client makes a persistent connection to some entity X.
The possible options we have here is:
|=Backend=
(client) ----------|-(web server)-----------(messageq)------> process message
| ^--backchannel connection
|=Backend=
(client) ----------|-(messageq)------> process message
|
What is the recommended best practice here? Where does the message queue sit in standard enterprise architectures? Also, if you know of a best practice please share how you come to learn that information (what resources / book contains this knowledge?). Thank you.
When the client is a web-browser:
Let me do some Q&A, based on which your question may get answered
Q1: Do we expose application Database to our clients, for simple read operations?
A1: No, we want to control what is exposed to the client
Q2: Based on Q1, does it makes sense to expose messaging-queue to the client?
A2: No, for the same reasons as A2.
When the messaging-queue is exposed to the WebClient:
Q1: What will happen if the messaging queue provider needs to be changed from let's say Rabbit-Mq to Kafka?
A1: Old mobile applications will break. Web-Client needs to be changed in order to compatible with the new queue. (Bad architecture)
Q2: Can someone tap into another topic/queue as well with-in the same messaging-queue ?
A2: Yes (Bad architecture)
When the client is another service:
Inter-service communication using shared messaging-queue is a pattern used for async-communication by many applications.