Skip to Content
Pythonによるアーキテクチャパターン
book

Pythonによるアーキテクチャパターン

by Harry Percival, Bob Gregory
March 2025
Intermediate to advanced
304 pages
4h 33m
Japanese
O'Reilly Media, Inc.
Content preview from Pythonによるアーキテクチャパターン

第9章. メッセージバスで街に出る

この作品はAIを使って翻訳されている。ご意見、ご感想をお待ちしている:translation-feedback@oreilly.com

この章では、イベントをアプリケーションの内部構造にとってより基本的なものにしていく。 図9-1のような、イベントはオプションの副次的なものである状態から、アプリケーションの内部構造をより基本的なものに変えていく。

apwp 0901
図9-1. 前:メッセージ・バスはオプションのアドオンである

...図9-2のような状況になると、すべてがメッセージバスを経由するようになり、我々のアプリは根本的にメッセージプロセッサーへと変貌を遂げる。

apwp 0902
図9-2. メッセージ・バスは今やサービス・レイヤへの主要な入り口である。
チップ

この章のコードはGitHubのchapter_09_all_messagebusブランチにある:

git clone https://github.com/cosmicpython/code.git
cd code
git checkout chapter_09_all_messagebus
# or to code along, checkout the previous chapter:
git checkout chapter_08_events_and_message_bus

新たな要求が新たなアーキテクチャへと導く

リッチ・ヒッキーは、実世界のプロセスを管理し、長時間稼動するソフトウェアを意味する「位置づけソフトウェア」について語る。例としては、倉庫管理システム、物流スケジューラー、給与計算システムなどがある。

物理的なオブジェクトと信頼できない人間という現実の世界では、常に予期せぬことが起こるからだ。例えばこうだ:

  • 棚卸しの際、3つのSPRINGY-MATTRESSesが屋根からの雨漏りによって水害を受けていることが判明した。

  • RELIABLE-FORKの荷物が必要書類に不備があり、税関で数週間留め置かれた。その後、3台のRELIABLE-FORKが安全性テストに不合格となり、廃棄された。

  • 世界的なスパンコールの不足により、次のロットの製造が不可能となった。SPARKLY-BOOKCASE.

このような状況では、すでにシステムに入っているバッチの数量を変更する必要性について学ぶ。 おそらく誰かがマニフェストの数字を間違えたか、トラックからソファが落ちたのだろう。企業との会話に従って、この状況を図9のようにモデル化する、1この状況を図9-3のようにモデル化する。

apwp 0903
図9-3. バッチ量が変更されたとは、割り当て解除と再割り当てを意味する。
[ditaa, apwp_0903] +----------+ /----\ +------------+ +--------------------+ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

技術リーダーシップのための14のヒント

技術リーダーシップのための14のヒント

島田 浩二
Kubernetesで実践するクラウドネイティブDevOps

Kubernetesで実践するクラウドネイティブDevOps

John Arundel, Justin Domingus, 須田 一輝, 渡邉 了介
AWS上のシステム設計

AWS上のシステム設計

Jayanth Kumar, Mandeep Singh

Publisher Resources

ISBN: 9798341624863