Difference Between Synchronous and Asynchronous Messaging

Synchronous Messages

Synchronous messaging involves a client that waits for the server to respond to a message. Messages are able to flow in both directions, to and from. Essentially it means that synchronous messaging is a two way communication. i.e. Sender sends a message to receiver and receiver receives this message and gives reply to the sender. Sender will not send another message until it gets a reply from receiver.

Asynchronous Messages

Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server. So even if the client is down, the messaging will complete successfully. Asynchronous Messaging means that, it is a one way communication and the flow of communication is one way only.

Advantages and Disadvantages of Synchronous vs Asynchronous Messaging:-

There are some key advantages to asynchronous messaging. They enable flexibility and offer higher availability – There’s less pressure on the system to act on the information or immediately respond in some way. Also, one system being down does not impact the other system. For example, emails – you can send thousands of emails to your friend without her having to revert back to you.

The drawbacks of asynchronous collaboration are that they can lack a sense of immediacy. There’s less immediate interaction. Think about doing a chat with your friend on an instant messenger(WhatsApp) over phone – it isn’t a chat or a conversation unless your friend is replying back to you promptly.

Asynchronous message passing allows more parallelism. Since a process does not block, it can do some computation while the message is in transit. In the case of receive, this means a process can express its interest in receving messages on multiple ports simultaneously.

Asynchronous message passing introduces several problems. What happens if a message cannot be delivered? What if the message was lost in the transmission?

Another problem related to asynchronous message passing has to do with buffering. If messages sent asynchronously are buffered in a space managed by the OS, then a process may fill this space by flooding the system with a large number of messages.

Which one is better – Synchronous or Asynchronous?

There isn’t an answer for this question. For many organizations, asynchronous and synchronous messaging will each prove valuable in their own way. There are situations where one will work but the other one won’t. As per PeopleSoft – both synchronous and asynchronous messages are used.

No comments:

Post a Comment

PeopleCode to retrieve Google map between two addresses

  PeopleCode Example: /* Define constants for the API request */ Local string &origin = "123 Main St, Anytown, USA";   /* ...