The most largely used architecture for web applications is “Client server” and the communication between both participants is the following: Client sends a request to the server which will process this data and sends the response
Typical Example is google: when you search a word, the server answers to your question and sends the relative page.
There are a lot of a ways to perform client-server communication for example using web services or by calling a RMI in each cases the communication maybe synchronous (the client waits until the server sends the response, this is the most used) or asynchronous (otherwise, like a sms in the cellular network: the client sends the request and keeps on doing his operations. After receiving the response from the server the client shows it)
The asynchronous communication needs that the client sends the message in a server queue. The server scans the queue and processes that data only when it’s ready
The architecture that bases the communication on messages is called “MOA: Message Oriented Architecture” and the software that performs the queue is called MOM (Message Oriented Middleware)
The queue can be placed for example in data base or into file system of the server or there are special structures of the data that are provided by programming languages and servers. The libraries uses by java for the making this queue are Java Message Service (JMS).
JMS allows to use a queue stored on server (it is necessary to use JNDI
to have an access of this queue) and to create a producer and a consumer of this queue and both the member of the communication can exchanges as text messages as objects.
Messaging is a form of loosely coupled distributed communication, where in this context the term ‘communication’ can be understood as an exchange of messages between software components. Message-oriented technologies attempt to relax tightly coupled communication (such as TCP network sockets or RMI) by the introduction of an intermediary component. This approach allows software components to communicate ‘indirectly’ with each other. Benefits of this include message senders not needing to have precise knowledge of their receivers.
The advantages of messaging include the ability to integrate heterogeneous platforms, reduce system bottlenecks, increase scalability, and respond more quickly to change.