Rename book to Process Control

This commit is contained in:
MatsuneMikuroi committed 2026-09-29 12:34:56 +02:00
1 parent 919e79eb2a
commit afb816f459
53 files changed
+5587 -503

No files matched your search

+63 -19
View File
@@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>3&nbsp; Part II — Cross the process boundary – From Calling to Eventing</title>
<title>3&nbsp; Part II — Cross the process boundary – Process Control</title>
<style>
/* Default styles provided by pandoc.
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
@@ -87,9 +87,13 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<link href="site_libs/quarto-contrib/calc-exo-2.0.0/exo.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-quiz-1.0.0/quiz.js"></script>
<link href="site_libs/quarto-contrib/calc-quiz-1.0.0/quiz.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-further-1.0.0/further.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-latex-tables-1.0.0/latex-tables.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-notes-1.0.0/calc-notes.js"></script>
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/theme.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/high-contrast.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/calc-notes.css" rel="stylesheet">
<link href="site_libs/quarto-contrib/calc-notes-1.0.0/narrow.css" rel="stylesheet">
<script src="site_libs/quarto-contrib/calc-glossary-2.0.0/glossary.js"></script>
<link href="site_libs/quarto-contrib/calc-glossary-2.0.0/glossary.css" rel="stylesheet">
<script id="quarto-search-options" type="application/json">{
@@ -132,7 +136,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
nothing is attached to the links themselves: one capture-phase listener on
the document reads the link's final address at click time.
If a language has not been built (./render-all.sh), its pages do not exist:
If a language has not been built, its pages do not exist:
the target is checked first and a short note is shown instead of a
"Not Found" page.
@@ -148,12 +152,9 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
var ROOT_LANG = 'en'; // the language at the top of _book/
var COOKIE = 'notes-lang';
var NOTE = {
de: 'Diese Sprache wurde noch nicht erstellt. Einmal ./render-all.sh ausführen – '
+ 'danach funktioniert der Wechsel auch in der Vorschau.',
fr: 'Cette langue n’a pas encore été générée. Lancez une fois ./render-all.sh : '
+ 'ensuite le changement fonctionne aussi dans l’aperçu.',
en: 'This language hasn’t been built yet. Run ./render-all.sh once, '
+ 'then switching works in the preview too.'
de: 'Diese Sprache ist hier noch nicht verfügbar.',
fr: 'Cette langue n’est pas encore disponible ici.',
en: 'This language is not available here yet.'
};
var here = (document.documentElement.lang || ROOT_LANG).slice(0, 2);
@@ -167,9 +168,20 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
var m = document.cookie.match(/(?:^|;\s*)notes-lang=(de|fr|en)(?:;|$)/);
return m ? m[1] : null;
}
// path '/' on purpose: every book of these notes is served from one host,
// each under its own folder, so a language picked in any of them is the
// language all of them open in. A book hosted on its own would be no worse
// off -- the cookie simply has nothing else to reach.
var COOKIE_PATH = '/';
function remember(code) {
document.cookie = COOKIE + '=' + code + '; path=' + root + '; max-age=31536000; SameSite=Lax'
document.cookie = COOKIE + '=' + code + '; path=' + COOKIE_PATH
+ '; max-age=31536000; SameSite=Lax'
+ (location.protocol === 'https:' ? '; Secure' : '');
// a copy written under the book's own path by an earlier version would be
// the more specific one and would shadow the shared cookie for good
if (root !== COOKIE_PATH) {
document.cookie = COOKIE + '=; path=' + root + '; max-age=0';
}
}
// a returning reader lands in the language picked last time
@@ -191,7 +203,11 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
box.style.cssText = 'position:fixed;left:50%;bottom:1.25rem;transform:translateX(-50%);'
+ 'max-width:min(34rem,calc(100vw - 2rem));padding:.6rem .9rem;border-radius:6px;'
+ 'background:#1f2328;color:#fff;font-size:.85rem;line-height:1.4;z-index:2000;'
+ 'box-shadow:0 4px 16px rgba(0,0,0,.25)';
// a status message, so it keeps its own dark surface in either mode; the
// hairline is the page's rule colour, invisible on a light page and an
// edge against a dark one, where the shadow alone no longer separates it
+ 'border:1px solid var(--calc-line,#444);'
+ 'box-shadow:0 4px 16px var(--calc-shadow,rgba(0,0,0,.25))';
document.body.appendChild(box);
setTimeout(function () { box.remove(); }, 7000);
}
@@ -232,7 +248,35 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
}, true);
})();
</script>
<style>:root { --calc-notecolor: #B45309; }</style>
<style>:root {
--calc-furthercolor-src: #6B3FA0;
--calc-furthercolor: var(--calc-furthercolor-src);
}</style>
<style>:root {
--calc-notecolor-src: #B45309;
--calc-notecolor: var(--calc-notecolor-src);
}</style>
<script>(function (e) {
var KEY = 'notes-contrast', forced = false;
var picked = null;
try { picked = localStorage.getItem(KEY); } catch (err) {}
var q = null;
try { q = window.matchMedia && window.matchMedia('(prefers-contrast: more)'); } catch (err) {}
if (picked === 'more' || (picked !== 'normal' && (forced || (q && q.matches)))) {
e.classList.add('hc');
}
if (q) {
var f = function () {
var p = null;
try { p = localStorage.getItem(KEY); } catch (err) {}
if (p === null) e.classList.toggle('hc', forced || q.matches);
};
if (q.addEventListener) q.addEventListener('change', f);
else if (q.addListener) q.addListener(f);
}
})(document.documentElement);</script>
</head>
@@ -261,7 +305,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<nav id="quarto-sidebar" class="sidebar collapse collapse-horizontal quarto-sidebar-collapse-item sidebar-navigation docked overflow-auto">
<div class="pt-lg-2 mt-2 text-left sidebar-header">
<div class="sidebar-title mb-0 py-0">
<a href="./">From Calling to Eventing</a>
<a href="./">Process Control</a>
<div class="sidebar-tools-main tools-wide">
<div class="dropdown">
<a href="" title="" id="quarto-navigation-tool-dropdown-0" class="quarto-navigation-tool dropdown-toggle px-1" data-bs-toggle="dropdown" aria-expanded="false" role="link" aria-label=""><i class="bi bi-translate"></i></a>
@@ -283,7 +327,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
</li>
</ul>
</div>
<a href="./From-Calling-to-Eventing.pdf" title="Download PDF" class="quarto-navigation-tool px-1" aria-label="Download PDF"><i class="bi bi-file-pdf"></i></a>
<a href="./Process-Control.pdf" title="Download PDF" class="quarto-navigation-tool px-1" aria-label="Download PDF"><i class="bi bi-file-pdf"></i></a>
<a href="" class="quarto-reader-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleReader(); return false;" title="Toggle reader mode">
<div class="quarto-reader-toggle-btn">
<i class="bi"></i>
@@ -308,7 +352,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<li class="sidebar-item">
<div class="sidebar-item-container">
<a href="./00-orientation.html" class="sidebar-item-text sidebar-link">
<span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What the tutorial is about</span></span></a>
<span class="menu-text"><span class="chapter-number">1</span>&nbsp; <span class="chapter-title">Step 0 — What this is about</span></span></a>
</div>
</li>
<li class="sidebar-item">
@@ -387,7 +431,7 @@ pre > code.sourceCode > span > a:first-child::before { text-decoration: underlin
<section id="sec-step-11" class="level2" data-number="3.1">
<h2 data-number="3.1" class="anchored" data-anchor-id="sec-step-11"><span class="header-section-number">3.1</span> Step 11 — Separate the components</h2>
<p>Three processes cannot share a <code>BlockingQueue</code>: every <code>java</code> command starts its own JVM with its own memory, so the <code>mailboxes</code> map would exist three times and each copy would see only its own messages. An external transport is needed.</p>
<p>TCP would do, MQTT would do. The tutorial deliberately picks the most primitive option, the <strong>filesystem</strong>, and gives a one-line reason: <em>because you can see it</em>. Messages become files you can list with <code>ls</code> and read with <code>cat</code> while the system runs. Primitive here does not mean inferior; part VIII comes back to what the filesystem is genuinely good and bad at.</p>
<p>TCP would do, MQTT would do. The most primitive option is picked deliberately, the <strong>filesystem</strong>, for a one-line reason: <em>because you can see it</em>. Messages become files you can list with <code>ls</code> and read with <code>cat</code> while the system runs. Primitive here does not mean inferior; part VIII comes back to what the filesystem is genuinely good and bad at.</p>
</section>
<section id="sec-steps-12-13" class="level2" data-number="3.2">
<h2 data-number="3.2" class="anchored" data-anchor-id="sec-steps-12-13"><span class="header-section-number">3.2</span> Steps 12–13 — A directory becomes a mailbox</h2>
@@ -430,7 +474,7 @@ TIMESTAMP: 2026-09-22T10:42:12.123Z</code></pre>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5"><pre class="sourceCode bash code-with-copy"><code class="sourceCode bash"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="bu">printf</span> <span class="st">'TEXT\nHello from a file'</span> <span class="op">&gt;</span> messageBoard/consoleOut/inbox/manual.tmp</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="fu">mv</span> messageBoard/consoleOut/inbox/manual.tmp messageBoard/consoleOut/inbox/manual.msg</span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p><strong>Observed:</strong> nothing happens when the <code>.tmp</code> file appears; the line is printed the moment the rename creates the <code>.msg</code> name. Both accepted formats work, with and without the trailing timestamp.</p>
<p>The architectural lesson is the one the tutorial draws as <code>producer → filesystem → consumer</code>: the consumer could not tell a human typing <code>mv</code> from a real service. It knows its own inbox, not who writes into it. Egoism survived the process boundary.</p>
<p>The architectural point reads <code>producer → filesystem → consumer</code>: the consumer could not tell a human typing <code>mv</code> from a real service. It knows its own inbox, not who writes into it. Egoism survived the process boundary.</p>
</section>
<section id="sec-steps-16-17" class="level2" data-number="3.5">
<h2 data-number="3.5" class="anchored" data-anchor-id="sec-steps-16-17"><span class="header-section-number">3.5</span> Steps 16–17 — Services and mediator become processes</h2>
@@ -477,8 +521,8 @@ TIMESTAMP: 2026-09-22T10:42:12.123Z</code></pre>
</tr>
</tbody>
</table>
<p>The mediator is generic: its route is not compiled in, it arrives as two startup arguments. But the tutorial points at an asymmetry worth keeping in mind: the three capabilities receive their <strong>work</strong> as messages in a mailbox, while the mediator receives its <strong>route</strong> as startup configuration, and it has no name and no control mailbox of its own that anyone could write to.</p>
<p>The practical consequence: arguments are read once, so changing the route of a running mediator means stopping it and starting it again. A configuration file would be no different — it is still read at startup. The tutorial deliberately leaves this unfixed until the cost of the distributed mediators has been felt.</p>
<p>The mediator is generic: its route is not compiled in, it arrives as two startup arguments. But there is an asymmetry worth keeping in mind: the three capabilities receive their <strong>work</strong> as messages in a mailbox, while the mediator receives its <strong>route</strong> as startup configuration, and it has no name and no control mailbox of its own that anyone could write to.</p>
<p>The practical consequence: arguments are read once, so changing the route of a running mediator means stopping it and starting it again. A configuration file would be no different — it is still read at startup. This stays deliberately unfixed until the cost of the distributed mediators has been felt.</p>
</section>
<section id="sec-step-18" class="level2" data-number="3.6">
<h2 data-number="3.6" class="anchored" data-anchor-id="sec-step-18"><span class="header-section-number">3.6</span> Step 18 — Run the fully external local version</h2>
@@ -489,7 +533,7 @@ TIMESTAMP: 2026-09-22T10:42:12.123Z</code></pre>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a><span class="ex">java</span> Mediator.java rot13/outbox consoleOut/inbox <span class="co"># terminal 4</span></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="ex">java</span> ActuatorService.java <span class="co"># terminal 5</span></span></code></pre></div><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></div>
<p><strong>Observed:</strong> <code>Hello World</code> typed in terminal 1 appeared as <code>Uryyb Jbeyq</code> in terminal 5. The three middle terminals showed nothing new — each mediator prints one “Mediating: …” line at startup, and <code>ProcessorService</code> prints nothing at all. Afterwards each of the four mailbox directories held one <code>.msg</code> file: the same line, copied along the chain.</p>
<p>Count it: <strong>five processes</strong> for what step 1 did in one statement. The tutorial’s instruction at this point is not to optimise: “We are not done making it painful.”</p>
<p>Count it: <strong>five processes</strong> for what step 1 did in one statement. This is not the moment to optimise: it is not meant to be comfortable yet.</p>
<div id="fig-filesystem-processes" class="flow-figure quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-filesystem-processes-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">