• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Diffrence between synchronous and asynchronous messaging

 
RashmiK Bhojwani
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever I read about difference between synchronous and asynchronous messaging, it was always discussed in terms of Message Consumption(http://docs.oracle.com/javaee/6/tutorial/doc/bncdx.html, refer to the last para)

Message Consumption

Messaging products are inherently asynchronous: There is no fundamental timing dependency between the production and the consumption of a message. However, the JMS specification uses this term in a more precise sense. Messages can be consumed in either of two ways:

    Synchronously: A subscriber or a receiver explicitly fetches the message from the destination by calling the receive method. The receive method can block until a message arrives or can time out if a message does not arrive within a specified time limit.

    Asynchronously: A client can register a message listener with a consumer. A message listener is similar to an event listener. Whenever a message arrives at the destination, the JMS provider delivers the message by calling the listener’s onMessage method, which acts on the contents of the message.



But when I read Common Architecture in OCM Exam Guide by Paul Allen and Joseph Bambara-

There are two modes of communication, depending on the level of coupling between the sender and receiver:
  • Synchronous
  •  Asynchronous

  • In synchronous mode, a distributed component sends a message via the MOM message queue to another component and waits for the reply to proceed further. The synchronous communication is “tightly coupled”—that is, both the sender and receiver know each other and rely on each other. The sender is responsible for retries in case of failures. This mode is typically used for transaction processing, where the sender needs the reliable response in real time (for example, stock purchase). When multiple messages are sent, they reach the destination in the same order in which they are sent. In asynchronous mode, the distributed component sends messages via the MOM message queue to the listening component and continues its processing without waiting for the response. This communication mechanism is “loosely coupled,” where sender and receiver need not have specific knowledge about each other. Messages arrive at the destination but not necessarily in same order in which they are sent. MOM is responsible for retry in case of failure in the communication. The asynchronous communication is desirable if the sender wants to broadcast messages to multiple receivers efficiently to handle high-volume processing.


    So now I am confused for the actual definition of Synchronous and Asynchronous Messaging in JMS.

    Please advice.
     
    Henry Wong
    author
    Marshal
    Pie
    Posts: 22089
    88
    C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    RashmiK Bhojwani wrote:
    So now I am confused for the actual definition of Synchronous and Asynchronous Messaging in JMS.


    The first quote is in regards to the JMS usage of those terms with Message Consumption. This quote also mentions that this terminology is *not* the traditional (more common) definition of those terms.

    The second quote is in regards to the traditional usage of those terms.

    Henry
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic