フィードを購読する

Having a grasp of common architectural patterns is essential to designing software architecture at scale. Using them saves not only time but also ensures a reliable implementation of your design. There’s no need to reinvent the wheel when there’s an architectural pattern available that applies to an architecture you’re developing.

The following is a brief overview of the Pub-Sub architectural pattern.

Understanding the Pub-Sub pattern

The Pub-Sub pattern is one in which a process sends a message into a message broker. Then, the message is forwarded to one or more parties listening for incoming messages according to a given topic. You can think of a topic as an “inbox.”

Sending a message to the broker is called publishing. Binding to a particular topic and then listening for incoming messages at the inbox is called subscribing. Hence, the term Pub-Sub.

Pub-Sub pattern

Pros

  • Pub-Sub activity is asynchronous (a.k.a, “fire and forget”). Hence, there is little risk of performance degradation due to a process getting caught in a long-running data exchange interaction.
  • Adding or removing subscribers to a topic is a matter of configuration. No complex programming is required. Thus, Pub-Sub systems provide a great deal of scalability and flexibility.

Cons

  • Testing can be a challenge. Because interactions are asynchronous, testing is not a matter of making a request and then analyzing the result. Rather a message must be sent into the system, and then the test needs to observe the behavior of the process(s) under test to see when and how it handles the message. And, if the process under test requires consuming many messages from a topic over time, the testing regimens can become more difficult to manage.
  • An unexpected surge in message emission can cause bottlenecks in the network and have unexpected results for the consuming message broker.
  • Requires a well-defined policy for message formatting and message exchange; otherwise, message consumption can become mangled and error-prone.

Putting it all together

The Pub-Sub pattern is the bedrock of asynchronous architectural design. There are a large number of messaging applications and cloud services dedicated to the Pub-Sub pattern. Using Pub-Sub can be tricky, particularly when there are many topics in play. Learning the basic concepts is straightforward, but implementations can be challenging depending on the messaging technology used and the scope of asynchronous activity that needs to be supported. Still, when it comes to implementing asynchronous communication among services and components in a large distributed application, the Pub-Sub pattern is quite popular.


執筆者紹介

Bob Reselman is a nationally known software developer, system architect, industry analyst, and technical writer/journalist. Over a career that spans 30 years, Bob has worked for companies such as Gateway, Cap Gemini, The Los Angeles Weekly, Edmunds.com and the Academy of Recording Arts and Sciences, to name a few. He has held roles with significant responsibility, including but not limited to, Platform Architect (Consumer) at Gateway, Principal Consultant with Cap Gemini and CTO at the international trade finance company, ItFex.

Read full bio
UI_Icon-Red_Hat-Close-A-Black-RGB

チャンネル別に見る

automation icon

自動化

テクノロジー、チームおよび環境に関する IT 自動化の最新情報

AI icon

AI (人工知能)

お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート

open hybrid cloud icon

オープン・ハイブリッドクラウド

ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。

security icon

セキュリティ

環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報

edge icon

エッジコンピューティング

エッジでの運用を単純化するプラットフォームのアップデート

Infrastructure icon

インフラストラクチャ

世界有数のエンタープライズ向け Linux プラットフォームの最新情報

application development icon

アプリケーション

アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細

Original series icon

オリジナル番組

エンタープライズ向けテクノロジーのメーカーやリーダーによるストーリー