This week's giveaway is in the Spring forum.
We're giving away four copies of liveProject: Protecting User Data with Spring Security and OAuth2 and have Laurentiu Spilca on-line!
See this thread for details.
Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Diffrence between synchronous and asynchronous messaging

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
     
    author
    Posts: 23899
    142
    jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
    • Likes 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Greenhorn
    Posts: 1
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    After reading this page, My confusion got double now.
     
    Marshal
    Posts: 72607
    317
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I thought Henry's explanation was clear: one quote refers to JMS and the other to what happens in other situations

    And welcome to the Ranch
     
    What's that smell? I think this tiny ad may have stepped in something.
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
    reply
      Bookmark Topic Watch Topic
    • New Topic