Recent from talks
Nothing was collected or created yet.
Messaging pattern
View on WikipediaThis article may be confusing or unclear to readers. (March 2019) |
In software architecture, a messaging pattern is an architectural pattern which describes how two different parts of an application, or different systems connect and communicate with each other. There are many aspects to the concept of messaging which can be divided in the following categories: hardware device messaging (telecommunications, computer networking, IoT, etc.) and software data exchange (the different data exchange formats and software capabilities of such data exchange). Despite the difference in the context, both categories exhibit common traits for data exchange.
General concepts of the messaging pattern
[edit]In telecommunications, a message exchange pattern (MEP) describes the pattern of messages required by a communications protocol to establish or use a communication channel. The communications protocol is the format used to represent the message which all communicating parties agree on (or are capable to process). The communication channel is the infrastructure that enables messages to "travel" between the communicating parties. The message exchange patterns describe the message flow between parties in the communication process, there are two major message exchange patterns — a request–response pattern, and a one-way pattern.
For example, when viewing content on the Internet (the channel), a web browser (a communicating party) would use the HTTP (the communication protocol) to request a web page from the server (another communicating party), and then render the returned data into its visual form. This is how the request–response messaging pattern operates.
Alternatively, in computer networking, we have the UDP network protocol. It is used with the one-way messaging pattern,[1] where the sending party is not interested whether the message arrives to any receiving party, nor it expects any of the receiving parties to produce an "answering" message.
Device communication
[edit]This section is about data exchange between hardware devices. In order for the devices to be able to read and exchange data, they would use a hardware-specific protocol (such as the radio signal) which is generated by a hardware device acting as a sending party (the radio tower), and can be interpreted by another hardware device which is the receiving party (your kitchen radio for instance). With the example of the radio, we have a one-way communication pattern, and the message exchange protocol is the radio signal itself.
Device communication may also refer to how the hardware devices in a message exchange system enable the message exchange. For example, when browsing the Internet, a number of different devices work in tandem to deliver the message through the internet traffic—routers, switches and network adapters, which on a hardware level send and receive signals in the form of TCP or UDP packages. Each such package could by itself be referred to as a message if we narrow our view to a pair of hardware devices communicating to one another, while in the general sense of the internet communication, a number of sequentially arranged packages together form a meaningful message, such as an image, or a web page.
Software communication
[edit]Unlike device communications, where the form of the message data is limited to protocols supported by the type and capabilities of the devices involved (for example in computer networking we have the TCP and UDP protocols, a walkie-talkie would sending radio waves in specific frequency, and a beacon would be flashing Morse code sequences that a person could read), a software can establish more complex and robust data exchange formats.
Those formats would be translated by the sending party in a form deliverable by the underlying hardware, and then decoded by the receiving party from the hardware-specific format to a form conforming to the original protocol established by the communicating software systems. This higher-level data exchange allows transferring information in a more-human readable form, and also enables usage of software encryption and decryption techniques to make messaging secure. Additionally, the software message exchange enables more variations of the message exchange pattern which are no-longer limited to the simple request-reply and one-way approaches. And last, but not least, software communication systems are capable of providing various channels for data exchange which can be used to optimize the message delivery, or to establish complex rules for selection and filtering which help deciding which parties to receive certain messages. This enables the possibility for software-orchestrated message routing. As result to the later, the concepts of a topic (where all receiving parties in a targeted group would be delivered a copy of the message) and a queue (where only one party in a targeted group would receive the message) have emerged.
As mentioned before, software messaging allows more options and freedom in the data exchange protocols. This, however, would not be very useful unless the communicating parties agree on the details of the protocol involved, and so a number of standardized software messaging protocols exist. This standardization allows different software systems, usually created and maintained by separate organizations, and which could be operating on different hardware devices (servers, computers, smart devices or IoT controllers), to participate in realtime data exchange.
Below are listed some of the most popular software messaging protocols, which are still in use today. Each of them provides extended meanings to the messaging concept described in the previous section.
SOAP
[edit]The term message exchange pattern has an extended meaning within the Simple Object Access protocol (SOAP).[2][3] SOAP MEP types include:
- In-Only: This is equivalent to one-way. A standard one-way messaging exchange where the consumer sends a message to the provider that does not send any type of response.
- Robust In-Only: This pattern is for reliable one-way message exchanges. The consumer initiates with a message to which the provider responds with status. If the response is a status, the exchange is complete, but if the response is a fault, the consumer must respond with a status.
- In-Out: This is equivalent to request–response. A standard two-way message exchange where the consumer initiates with a message, the provider responds with a message or fault and the consumer responds with a status.
- In-Optional-Out: A standard two-way message exchange where the provider's response is optional.
- Out-Only: The reverse of In-Only. It primarily supports event notification. It cannot trigger a fault message.
- Robust Out-Only: Similar to the out-only pattern, except it can trigger a fault message. The outbound message initiates the transmission.
- Out-In: The reverse of In-Out. The provider transmits the request and initiates the exchange.
- Out-Optional-In: The reverse of In-Optional-Out. The service produces an outbound message. The incoming message is optional ("Optional-in").
ØMQ
[edit]The ØMQ message queueing library provides so-called sockets (a kind of generalization over the traditional IP and Unix sockets) which require indicating a messaging pattern to be used, and are optimized for each pattern. The basic ØMQ patterns are:[4]
- Request–reply connects a set of clients to a set of services. This is a remote procedure call and task distribution pattern.[clarification needed]
- Publish–subscribe connects a set of publishers to a set of subscribers. This is a data distribution pattern.[clarification needed]
- Push–pull connects nodes in a fan-out / fan-in pattern that can have multiple steps, and loops. This is a parallel task distribution and collection pattern.[clarification needed]
- Exclusive pair connects two sockets in an exclusive pair. This is a low-level pattern for specific, advanced use cases.
Each pattern defines a particular network topology. Request-reply defines so-called "service bus", publish-subscribe defines "data distribution tree", push-pull defines "parallelised pipeline". All the patterns are deliberately designed in such a way as to be infinitely scalable and thus usable on Internet scale.[5]
REST
[edit]The REST protocol is a messaging protocol built on top of the HTTP protocol, and, similarly, uses the request-reply pattern of message exchange. While HTTP's primary goal is to deliver web pages and files over the Internet which are targeted for a human end-user, the REST protocol is mostly used for communication between different software systems, and has a key role in the microservices software architecture pattern. Among the notable qualities of the REST protocol is that it is versatile enough to represent data in many other formats (typically JSON and XML) and that it provides additional metadata descriptors for the message it represents. The metadata descriptors follow the HTTP standards by being represented as HTTP headers (which are standardized by the underlying HTTP protocol) and so they could be used as instructions for the receiving party on how to interpret the message payload. Because of that, REST greatly improves the development of a software system that is capable of communicating with another software system, since the developers need to be aware only of the higher-level format of the message payload (the JSON or XML model). The actual HTTP communication is usually handled by a software library or framework.
Another great quality of the REST protocol is that it is suitable to build other protocol semantics on top of it, which is the example with HATEOAS.
See also
[edit]References
[edit]- ^ Erl, Thomas (2005). Service Oriented Architecture: Concepts, Technology, and Design. Indiana: Pearson Education. p. 171. ISBN 0-13-185858-0.
- ^ http://www.w3.org/TR/soap12-part1/#soapmep SOAP MEPs in SOAP W3C Recommendation v1.2
- ^ Web Services Description Language (WSDL) Version 2.0: Additional MEPs
- ^ ØMQ User Guide
- ^ "Scalability Layer Hits the Internet Stack". Archived from the original on 2019-05-28. Retrieved 2011-02-03.
External links
[edit]Messaging pattern
View on GrokipediaFundamentals
Definition and Overview
Messaging patterns refer to reusable architectural solutions for exchanging structured data, referred to as messages, between producers and consumers in software systems, primarily to enable asynchronous communication and decouple interacting components.[4] This approach allows senders and receivers to operate independently, minimizing direct dependencies and facilitating integration across diverse applications.[4] At their core, messaging patterns embody principles such as decoupling senders from receivers by reducing assumptions about each other's platform, location, and timing; fault tolerance to manage system interruptions; scalability through intermediary components; and compatibility with various transport protocols for reliable data exchange.[4] These principles promote loose coupling, where "the core principle behind loose coupling is to reduce the assumptions two parties make about each other when they exchange information."[4] The benefits of messaging patterns include enhanced reliability in distributed environments by ensuring message delivery despite failures, reduced latency in high-volume data flows via asynchronous processing, and greater flexibility when integrating heterogeneous systems through standardized message handling.[4] High-level use cases encompass coordinating microservices within cloud-native applications and synchronizing data from sensors in networked IoT environments.[4]Historical Development
The origins of messaging patterns trace back to the 1970s, when message-oriented middleware (MOM) emerged as a foundational approach for inter-process communication in distributed systems. Pioneered by IBM in mainframe environments, early MOM systems facilitated asynchronous data exchange between applications, addressing the limitations of synchronous interactions in large-scale computing setups.[5] Concurrently, Unix pipes, introduced in 1973, provided a simple yet influential mechanism for piping data streams between processes, laying groundwork for decoupled communication paradigms that would later influence modern messaging.[6] By the 1980s, the concept of middleware gained traction for integrating legacy mainframe systems, with MOM evolving to support reliable message queuing in enterprise settings.[7] The 1990s marked significant milestones in standardizing messaging for enterprise integration. IBM released MQSeries in 1993, introducing robust message queuing capabilities across heterogeneous platforms, which became a cornerstone for reliable, asynchronous communication in business applications.[8] In 1998, Sun Microsystems launched the Java Message Service (JMS) as part of the Java 2 Enterprise Edition (J2EE) platform, providing a portable API for MOM that enabled Java applications to interact with various messaging providers, promoting portability and decoupling in distributed environments.[9] Advancements in the 2000s were driven by the rise of service-oriented architecture (SOA), which emphasized loose coupling through messaging to integrate disparate systems. The Advanced Message Queuing Protocol (AMQP), initiated by John O'Hara at JPMorgan Chase in 2003 and standardized by OASIS as version 1.0 in 2012, emerged as an open standard for interoperable messaging, supporting complex routing and reliability features essential for financial and enterprise use cases.[10] SOA's adoption in the mid-2000s further propelled messaging patterns, with enterprise service buses (ESBs) serving as central hubs for message orchestration and transformation.[11] Key contributions included Gregor Hohpe and Bobby Woolf's Enterprise Integration Patterns (2003), which cataloged 65 reusable patterns for messaging-based integration, influencing architectural design across industries.[12] From the 2010s onward, messaging patterns integrated deeply with cloud computing, microservices, and Internet of Things (IoT) ecosystems, adapting to demands for scalability and real-time processing at internet scale. Apache Kafka, open-sourced by LinkedIn in 2011, revolutionized event streaming by enabling high-throughput, durable message handling for big data pipelines.[13] The MQTT protocol achieved OASIS standardization in 2014, optimizing lightweight messaging for resource-constrained IoT devices and low-bandwidth networks; this was followed by MQTT 5.0 in 2019, which introduced enhancements such as improved error handling, shared subscriptions, and better support for request-response patterns.[14][15] These developments, spurred by cloud-native architectures and microservices, shifted focus toward resilient, event-driven systems capable of handling massive distributed workloads.[16]Key Components
Message Structure and Types
In messaging patterns, a message typically consists of a header, body, and optional footer. The header contains metadata essential for routing and processing, such as routing keys to direct the message to specific destinations, timestamps indicating when the message was created, and priorities to determine handling order.[](https://www.enterpriseintegrationpatterns.com/patterns/messaging/Introduction.html) The body holds the payload, which is the core data being transmitted, often formatted in structured text like JSON for readability and interoperability or XML for detailed markup, or in binary formats for compactness. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/Introduction.html) Footers, when present, include integrity checks like checksums to verify that the message has not been altered during transmission, ensuring data reliability in protocols such as AMQP.
Messages are classified into several types based on their intent and content. Command messages carry instructions to invoke actions or procedures in a receiving application, such as triggering a process update. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/CommandMessage.html) Event messages notify recipients of state changes or occurrences without expecting a response, enabling asynchronous awareness across systems. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/EventMessage.html) Document messages transfer data payloads for storage or further processing, allowing the receiver to decide on usage without implied actions. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/DocumentMessage.html)
To optimize transmission, messages often employ encoding and serialization techniques that define schema-based data representation. Protocol Buffers (Protobuf) serializes structured data into a compact binary format, supporting efficient parsing and reducing bandwidth usage through predefined schemas. [](https://protobuf.dev/overview/) Similarly, Apache Avro provides schema evolution capabilities alongside binary serialization, allowing fields to be added or removed without breaking compatibility in evolving systems. [](https://avro.apache.org/docs/current/spec.html) These methods contrast with text-based formats by minimizing overhead while maintaining type safety.
Error handling within messages incorporates elements like correlation IDs and acknowledgments to track and confirm delivery. A correlation ID is a unique identifier assigned to a request message and echoed in the reply, enabling the sender to match responses accurately across asynchronous exchanges. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/CorrelationIdentifier.html) Acknowledgments serve as confirmation mechanisms, where the receiver signals successful receipt or processing, often integrated into patterns for guaranteed delivery to prevent loss. [](https://www.enterpriseintegrationpatterns.com/patterns/messaging/GuaranteedMessaging.html)
Size and performance trade-offs arise from format choices, influencing messaging efficiency. Verbose formats like XML prioritize human readability and broad interoperability but increase payload size and parsing time, suitable for collaborative environments. Compact binary formats, such as those from Protobuf or Avro, significantly reduce message size compared to text-based formats like XML or JSON, enhancing throughput in bandwidth-constrained or high-volume scenarios like IoT streams, though they require schema knowledge for decoding. [](https://dl.ifip.org/db/conf/networking/networking2020/1570620395.pdf)
