Communication & Streaming




 Effective communication is the foundation of modern technology, allowing the transmission of data and instructions across various components and systems. To ensure successful and dependable communication, it is critical to select the appropriate approach that corresponds to the specific demands of the current circumstance. I will explain three separate communication mechanisms in this discussion: message queuing, publish/subscribe messaging, and Remote Procedure Call (RPC). For each of these methods, I will provide an illustrative application scenario within the Fresh Retail industry, along with a rationale for our selection of the communication method. This exploration will help us understand when and why to use these communication methods in various contexts, optimizing the communication process for the intended purpose.



Aspect

Message Queuing

Publish/Subscribe Messaging

RPC (Remote Procedure Call)

Communication Model

Point-to-point (one-to-one)

One-to-many (broadcast)

Point-to-point (one-to-one)

Message Order

Maintains strict order

No guarantee of order

Maintains strict order

Coupling

Tight coupling

Loose coupling

Tight coupling

Scalability

Can be less scalable

Highly scalable

Can be less scalable

Latency

Lower latency

Slightly higher latency

Lower latency

Table 1. A quick comparison of the three communication methods: Message Queuing, Publish/Subscribe Messaging, RPC


Message queuing: 

Message queuing is a communication method that enables the exchange of information between different components or systems. In this approach, messages are deposited into a queue and can be retrieved and processed by recipients at their convenience (Hailperin, 2019; What Is a Message Queue?, 2017). This method is characterized by the decoupling of senders and receivers, meaning that the sender and receiver don't have to be actively communicating at the same time. Messages remain in the queue until processed, ensuring data integrity and allowing for efficient handling of high volumes of data. In a fresh retail chain, inventory levels for various products need to be continuously monitored and updated in real-time. As customers make purchases in physical stores and online, changes in stock levels must be recorded instantly. Kafka can serve as the message queue where every sales transaction or inventory update is published as a message. Each message contains information about the product, the store location, and the quantity added or subtracted. Subscribers, such as inventory management systems, can consume these messages and update their records accordingly.


Publish/Subscribe Messaging:


In contrast, Publish/Subscribe Messaging is a different communication paradigm. It operates as a one-to-many communication model where a message, once published, is broadcast to multiple subscribers (Hailperin, 2019; Publish-Subscribe - NATS Docs, n.d.) . This approach is asynchronous, meaning that publishers and subscribers operate independently, and there is no strict requirement for synchronous communication. It is particularly useful in scenarios where real-time updates, event notifications, and broadcasting of information to multiple recipients are necessary. Unlike message queuing, Publish/Subscribe Messaging doesn't guarantee the order in which subscribers receive messages, and it offers a high degree of decoupling between publishers and subscribers. A fresh retail chain requires real-time updates on stock levels across all its stores. When stock levels change, notifications need to be broadcast to various teams, including inventory management, distribution, and store managers. In this scenario, Publish/Subscribe Messaging can be employed. When stock levels change, a message is published to a topic such as "StockUpdates." Subscribers, including inventory management systems, distribution teams, and store managers, subscribe to this topic. This ensures that all relevant parties receive immediate notifications when stock levels are updated.


Remote Procedure Call (RPC)

Remote Procedure Call (RPC) is yet another communication paradigm that distinguishes itself from both message queuing and Publish/Subscribe Messaging. RPC is a method for enabling one program to request a service from another program located on a remote computer in a network (Hailperin, 2019; Tanenbaum and Bos, 2015 ). It operates on a point-to-point communication model, where a client program initiates a procedure call on a remote server program as if it were a local procedure call. In a fresh retail chain, various components and systems need to request inventory updates from a central inventory management server. This can include querying current stock levels, requesting restocking, or checking for product availability. In this scenario, components that require inventory information can use RPC to make requests to the central inventory server. The requests are sent in the form of remote procedure calls, such as "CheckStockLevel" or "RequestRestock." The central server processes these requests and returns the results to the requesting components, ensuring real-time and accurate inventory information.


In conclusion, the choice of communication method depends on the specific requirements and constraints of the scenario at hand. By understanding the strengths and use cases of these methods, we can make informed decisions, optimizing communication processes to suit the intended purpose. Whether it's ensuring data integrity, real-time updates, or remote service requests, the right communication method is the linchpin of a well-functioning technology ecosystem.


References:
Hailperin, M. (2019). Operating systems and middleware: Supporting controlled interaction. Thomson Learning, Inc.: San Francisco, CA.


Tanenbaum, A. S., & Bos, H. (2015). Modern Operating Systems (4th ed.). Pearson Education.


What is a Message Queue? (2017). Amazon Web Services, Inc. https://aws.amazon.com/message-queue/


Publish-Subscribe - NATS Docs. (n.d.). https://docs.nats.io/nats-concepts/core-nats/pubsub





thienhang.com