From 8121d1611364282d967c24f37d4b02b2c72d6ed5 Mon Sep 17 00:00:00 2001 From: Romain De Groote Date: Tue, 6 Oct 2026 10:03:48 +0200 Subject: [PATCH] Part IX chapter (with Part VIII folded in) and the log through step 78 Co-Authored-By: Claude Opus 5 --- 08-part-ix-mqtt.qmd | 361 ++++++++++++++++++++++++++++++++++++ conv/00-setup-and-step-0.md | 4 +- conv/01-part-I.md | 4 +- conv/02-part-II.md | 4 +- conv/03-part-III.md | 4 +- conv/04-part-IV.md | 4 +- conv/05-part-V.md | 4 +- conv/06-part-VI.md | 4 +- conv/07-part-VII.md | 8 +- conv/08-part-VIII-IX.md | 86 +++++++++ 10 files changed, 465 insertions(+), 18 deletions(-) create mode 100644 08-part-ix-mqtt.qmd create mode 100644 conv/08-part-VIII-IX.md diff --git a/08-part-ix-mqtt.qmd b/08-part-ix-mqtt.qmd new file mode 100644 index 0000000..e452dbc --- /dev/null +++ b/08-part-ix-mqtt.qmd @@ -0,0 +1,361 @@ +# [Part IX — MQTT]{.en}[Partie IX — MQTT]{.fr}[Teil IX — MQTT]{.de} {#sec-part-ix} + + + +## [What the filesystem taught, and what it is not for]{.en}[Ce que le système de fichiers a enseigné, et ce pour quoi il n'est pas fait]{.fr}[Was das Dateisystem gelehrt hat und wofür es nicht taugt]{.de} {#sec-filesystem-verdict} + +::: {.en} +The filesystem taught publication boundaries, directories as addresses, observation, independent processes, independent languages, synchronisation latency, runtime wiring, State, Intent, Events, mediator costs, service ownership and transformer services. It was a good teacher and it is not an elegant message broker: by the end the architecture was clean and the transport was a pile of `.tmp` files, atomic moves, rescanning, shared paths and replication delay. + +The conclusion is **not** "files bad, MQTT good". The filesystem has an advantage MQTT cannot match — it routinely stores gigabytes or terabytes, while brokers and clients are built for small messages, and chunking a huge payload over MQTT means inventing a file-transfer protocol inside a message protocol. So: + +> Use messages for coordination and events. Use an appropriate file or object store for large data. A message can carry the **location, identity and metadata** of that data instead of the terabytes themselves. + +A replicated filesystem also gives every machine a local copy, which is a genuine strength — though replication is not a backup: deletion and corruption replicate too, unless versioning preserves older copies. +::: + +::: {.fr} +Le système de fichiers a enseigné les frontières de publication, les répertoires comme adresses, l'observation, des processus indépendants, des langages indépendants, la latence de synchronisation, le câblage à l'exécution, le State, l'Intent, les Events, le coût des médiateurs, la propriété des services et les services transformateurs. Ce fut un bon professeur, et ce n'est pas un courtier de messages élégant : à la fin, l'architecture était propre et le transport était un amas de fichiers `.tmp`, de déplacements atomiques, de rescans, de chemins partagés et de délais de réplication. + +La conclusion n'est **pas** « fichiers mauvais, MQTT bon ». Le système de fichiers a un avantage que MQTT ne peut égaler — il stocke couramment des gigaoctets ou des téraoctets, alors que courtiers et clients sont conçus pour de petits messages, et découper une charge énorme sur MQTT revient à inventer un protocole de transfert de fichiers dans un protocole de messages. Donc : + +> Utilisez les messages pour la coordination et les événements. Utilisez un stockage de fichiers ou d'objets adapté pour les grandes données. Un message peut porter l'**emplacement, l'identité et les métadonnées** de ces données au lieu des téraoctets eux-mêmes. + +Un système de fichiers répliqué donne aussi à chaque machine une copie locale, ce qui est une vraie force — mais la réplication n'est pas une sauvegarde : suppressions et corruptions se répliquent aussi, à moins qu'un versionnement conserve les copies antérieures. +::: + +::: {.de} +Das Dateisystem lehrte Veröffentlichungsgrenzen, Verzeichnisse als Adressen, Beobachtung, unabhängige Prozesse, unabhängige Sprachen, Synchronisationslatenz, Verdrahtung zur Laufzeit, State, Intent, Events, Vermittlerkosten, Dienstbesitz und Transformatordienste. Es war ein guter Lehrer und ist kein eleganter Nachrichten-Broker: am Ende war die Architektur sauber und der Transport ein Haufen `.tmp`-Dateien, atomarer Verschiebungen, erneuter Scans, geteilter Pfade und Replikationsverzögerung. + +Die Schlussfolgerung ist **nicht** „Dateien schlecht, MQTT gut". Das Dateisystem hat einen Vorteil, den MQTT nicht erreicht — es speichert routinemässig Gigabytes bis Terabytes, während Broker und Clients für kleine Nachrichten gebaut sind, und das Stückeln einer riesigen Nutzlast über MQTT heisst, ein Dateitransferprotokoll in einem Nachrichtenprotokoll zu erfinden. Also: + +> Nachrichten für Koordination und Ereignisse. Für grosse Daten ein passender Datei- oder Objektspeicher. Eine Nachricht kann **Ort, Identität und Metadaten** dieser Daten tragen statt der Terabytes selbst. + +Ein repliziertes Dateisystem gibt zudem jeder Maschine eine lokale Kopie, eine echte Stärke — doch Replikation ist kein Backup: Löschungen und Beschädigungen replizieren mit, sofern nicht eine Versionierung ältere Kopien bewahrt. +::: + +## [MQTT should look familiar]{.en}[MQTT devrait sembler familier]{.fr}[MQTT sollte vertraut wirken]{.de} {#sec-mqtt-mapping} + +::: {.en} +| filesystem / Syncthing | MQTT | +|---|---| +| synchronised message-board root | broker / namespace | +| directory path | topic | +| `.msg` file | publication | +| file contents | payload | +| `WatchService` | subscription | +| dynamic directory | topic / filter | +| control directory | `I` | +| state directory | `S/…` | +| event directory | `E/…` | + +The reaction the material is after: *"Oh. We already know this architecture."* MQTT is a transport change, not an architectural claim. + +Two things a directory could not do, both visible in a minute at the command line. A publication made **before** a subscriber exists never reaches it — the stranded-message lesson for the third time, now with an answer the filesystem never had. And a filter like `test/#` matches `test/a` and `test/a/b/c` but not `testing/x`, because `#` works on **levels**, not string prefixes; `test/+` would match only one level down. + +The deeper correction: **a topic is not a container.** There is no object called `test/a` on the broker. A topic is a routing key carried by each publication and matched against the filters of whoever is subscribed at that instant. Directories *hold* messages; topics *match* them. One subscription therefore covers topics that do not exist yet — where a message board needed a new directory and a new registration. +::: + +::: {.fr} +| système de fichiers / Syncthing | MQTT | +|---|---| +| racine du tableau de messages synchronisé | courtier / espace de noms | +| chemin de répertoire | sujet (*topic*) | +| fichier `.msg` | publication | +| contenu du fichier | charge utile | +| `WatchService` | abonnement | +| répertoire dynamique | sujet / filtre | +| répertoire de contrôle | `I` | +| répertoire d'état | `S/…` | +| répertoire d'événements | `E/…` | + +La réaction visée par le matériel : « Ah. Nous connaissons déjà cette architecture. » MQTT est un changement de transport, pas une affirmation architecturale. + +Deux choses qu'un répertoire ne pouvait pas faire, visibles en une minute en ligne de commande. Une publication faite **avant** l'existence d'un abonné ne lui parvient jamais — la leçon des messages bloqués, pour la troisième fois, mais avec une réponse que le système de fichiers n'avait pas. Et un filtre comme `test/#` correspond à `test/a` et `test/a/b/c` mais pas à `testing/x`, car `#` travaille par **niveaux** et non par préfixes de chaîne ; `test/+` ne correspondrait qu'à un seul niveau. + +La correction plus profonde : **un sujet n'est pas un conteneur.** Il n'existe aucun objet nommé `test/a` sur le courtier. Un sujet est une clé de routage portée par chaque publication et confrontée aux filtres de qui est abonné à cet instant. Les répertoires *contiennent* les messages ; les sujets les *filtrent*. Un seul abonnement couvre donc des sujets qui n'existent pas encore — là où un tableau de messages exigeait un nouveau répertoire et un nouvel enregistrement. +::: + +::: {.de} +| Dateisystem / Syncthing | MQTT | +|---|---| +| Wurzel des synchronisierten Nachrichtenbretts | Broker / Namensraum | +| Verzeichnispfad | Topic | +| `.msg`-Datei | Veröffentlichung | +| Dateiinhalt | Nutzlast | +| `WatchService` | Abonnement | +| dynamisches Verzeichnis | Topic / Filter | +| Steuerverzeichnis | `I` | +| Zustandsverzeichnis | `S/…` | +| Ereignisverzeichnis | `E/…` | + +Die gewünschte Reaktion des Materials: „Ach. Diese Architektur kennen wir schon." MQTT ist ein Transportwechsel, keine architektonische Aussage. + +Zwei Dinge, die ein Verzeichnis nicht konnte, in einer Minute auf der Kommandozeile sichtbar. Eine Veröffentlichung **vor** der Existenz eines Abonnenten erreicht ihn nie — die Lehre der liegengebliebenen Nachrichten zum dritten Mal, nun mit einer Antwort, die das Dateisystem nie hatte. Und ein Filter wie `test/#` passt auf `test/a` und `test/a/b/c`, nicht aber auf `testing/x`, weil `#` auf **Ebenen** arbeitet, nicht auf Zeichenpräfixen; `test/+` passte nur eine Ebene tief. + +Die tiefere Korrektur: **ein Topic ist kein Behälter.** Es gibt kein Objekt namens `test/a` auf dem Broker. Ein Topic ist ein Routing-Schlüssel, den jede Veröffentlichung trägt und der gegen die Filter derjenigen geprüft wird, die in diesem Moment abonniert haben. Verzeichnisse *halten* Nachrichten; Topics *vergleichen* sie. Ein Abonnement deckt daher Topics ab, die noch nicht existieren — wo ein Nachrichtenbrett ein neues Verzeichnis und eine neue Registrierung brauchte. +::: + +## [The library, the client id and the broker address]{.en}[La bibliothèque, l'identifiant client et l'adresse du courtier]{.fr}[Die Bibliothek, die Client-ID und die Broker-Adresse]{.de} {#sec-paho} + +::: {.en} +Java has no MQTT client in its standard library, so Paho arrives now — after the need, like the mediator in step 7 and Jackson in step 64. Four things are needed from it: connect, publish, subscribe, callback. Connecting is deliberately anticlimactic: *"Nothing architectural happened here. We merely attached our process to the transport."* + +Two details of connecting carry weight: + +- **the client id** is not merely a uniqueness token. The broker recognises a returning client by it and keeps session state for it: subscriptions, messages queued at QoS > 0, and the association with its Last Will. A directory never knew who was watching, which is exactly why a restarted watcher's backlog was never replayed. +- **the broker address** is deployment configuration: every runnable reads `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. It is also the one piece of configuration that cannot arrive as Intent, because Intent travels *through* the broker. Topology can be published; the address of the thing that publishes it cannot. + +Subscribing costs one packet, and **the broker keeps the subscription list**. There is no standard way to ask it what another client subscribed to — which is why `S/subscriptions` exists: a component's own declaration of its wiring, published so the architecture can know what the transport keeps private. Only its owner may publish it, by the one-writer rule, because only its owner knows what it accepted. +::: + +::: {.fr} +Java n'a pas de client MQTT dans sa bibliothèque standard ; Paho arrive donc maintenant — après le besoin, comme le médiateur à l'étape 7 et Jackson à l'étape 64. Quatre choses suffisent : se connecter, publier, s'abonner, rappeler. La connexion est volontairement anticlimatique : « Rien d'architectural ne s'est produit ici. Nous avons simplement attaché notre processus au transport. » + +Deux détails de la connexion comptent : + +- **l'identifiant client** n'est pas qu'un jeton d'unicité. Le courtier reconnaît par lui un client qui revient et conserve son état de session : abonnements, messages en file en QoS > 0, et l'association à sa dernière volonté. Un répertoire ne savait jamais qui l'observait, et c'est précisément pour cela qu'un observateur redémarré ne rejouait rien. +- **l'adresse du courtier** est de la configuration de déploiement : chaque programme lit `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. C'est aussi la seule configuration qui ne peut pas arriver par Intent, puisque l'Intent passe *par* le courtier. La topologie se publie ; l'adresse de ce qui la publie, non. + +S'abonner coûte un paquet, et **le courtier détient la liste des abonnements**. Il n'existe aucun moyen standard de lui demander à quoi un autre client s'est abonné — d'où `S/subscriptions` : la déclaration par un composant de son propre câblage, publiée pour que l'architecture sache ce que le transport garde privé. Seul son propriétaire peut la publier, par la règle de l'écrivain unique, car seul lui sait ce qu'il a accepté. +::: + +::: {.de} +Java hat keinen MQTT-Client in der Standardbibliothek, also kommt Paho jetzt — nach dem Bedarf, wie der Vermittler in Schritt 7 und Jackson in Schritt 64. Vier Dinge braucht man: verbinden, veröffentlichen, abonnieren, Rückruf. Das Verbinden ist absichtlich unspektakulär: „Hier ist architektonisch nichts geschehen. Wir haben unseren Prozess nur an den Transport angeschlossen." + +Zwei Details des Verbindens haben Gewicht: + +- **die Client-ID** ist nicht bloss ein Eindeutigkeitsmerkmal. Der Broker erkennt daran einen zurückkehrenden Client und hält Sitzungszustand für ihn: Abonnements, bei QoS > 0 eingereihte Nachrichten und die Verknüpfung mit seinem Last Will. Ein Verzeichnis wusste nie, wer es beobachtete — genau deshalb spielte ein neu gestarteter Beobachter nichts nach. +- **die Broker-Adresse** ist Deployment-Konfiguration: jedes Programm liest `System.getProperty("mqtt.broker", "tcp://localhost:1883")`. Sie ist auch die einzige Konfiguration, die nicht als Intent kommen kann, denn Intent reist *durch* den Broker. Topologie lässt sich veröffentlichen; die Adresse des Veröffentlichenden nicht. + +Abonnieren kostet ein Paket, und **der Broker führt die Abonnementliste**. Es gibt keinen Standardweg, ihn zu fragen, was ein anderer Client abonniert hat — daher `S/subscriptions`: die eigene Erklärung einer Komponente über ihre Verdrahtung, veröffentlicht, damit die Architektur weiss, was der Transport privat hält. Nur ihr Eigentümer darf sie veröffentlichen, nach der Ein-Schreiber-Regel, denn nur er weiss, was er angenommen hat. +::: + +## [Structured Intent, and two object mappers]{.en}[Intent structuré, et deux mappeurs]{.fr}[Strukturierter Intent und zwei Mapper]{.de} {#sec-structured-intent} + +::: {.en} +`TOPIC some/path` has one field and one meaning. It cannot say which *kind* of Intent this is, carry a second parameter, nest, or be extended; and there is nothing for a receiver to validate against. Richer Intent wants structure: + +```yaml +subscribe: + topic: Tutorial/ConsoleIn/U/alice/E/text +``` + +Only then does a serialisation library have a clear job. `JsonTools` keeps **two** mappers, and the asymmetry is deliberate: + +- reading uses a **YAML** factory with `FAIL_ON_UNKNOWN_PROPERTIES` off — JSON is a subset of YAML, so hand-typed Intent is accepted, and a newer configurator can send fields an older service ignores; +- writing uses plain **JSON** with `INDENT_OUTPUT` on, so published payloads are strict and readable. + +Tolerant in, strict out. A single shared mapper would have to give up one of those. +::: + +::: {.fr} +`TOPIC some/path` a un champ et un sens. Il ne peut pas dire de quel *type* d'Intent il s'agit, porter un second paramètre, s'imbriquer ou s'étendre ; et un récepteur n'a rien contre quoi valider. Un Intent plus riche demande une structure : + +```yaml +subscribe: + topic: Tutorial/ConsoleIn/U/alice/E/text +``` + +C'est seulement là qu'une bibliothèque de sérialisation a une tâche claire. `JsonTools` garde **deux** mappeurs, et l'asymétrie est voulue : + +- la lecture utilise une fabrique **YAML** avec `FAIL_ON_UNKNOWN_PROPERTIES` désactivé — JSON étant un sous-ensemble de YAML, un Intent tapé à la main est accepté, et un configurateur plus récent peut envoyer des champs qu'un service plus ancien ignore ; +- l'écriture utilise du **JSON** strict avec `INDENT_OUTPUT` activé, donc les charges publiées sont strictes et lisibles. + +Tolérant en entrée, strict en sortie. Un mappeur unique devrait renoncer à l'un des deux. +::: + +::: {.de} +`TOPIC some/path` hat ein Feld und eine Bedeutung. Es kann nicht sagen, welche *Art* Intent vorliegt, keinen zweiten Parameter tragen, nicht verschachteln, nicht erweitert werden; und ein Empfänger hat nichts, wogegen er prüfen könnte. Reicherer Intent braucht Struktur: + +```yaml +subscribe: + topic: Tutorial/ConsoleIn/U/alice/E/text +``` + +Erst dann hat eine Serialisierungsbibliothek eine klare Aufgabe. `JsonTools` hält **zwei** Mapper, und die Asymmetrie ist Absicht: + +- das Lesen nutzt eine **YAML**-Factory mit abgeschaltetem `FAIL_ON_UNKNOWN_PROPERTIES` — JSON ist eine Teilmenge von YAML, handgetippter Intent wird akzeptiert, und ein neuerer Konfigurator darf Felder senden, die ein älterer Dienst ignoriert; +- das Schreiben nutzt strenges **JSON** mit `INDENT_OUTPUT`, die veröffentlichten Nutzlasten sind also streng und lesbar. + +Tolerant hinein, streng hinaus. Ein einziger Mapper müsste auf eines davon verzichten. +::: + +## [DUISE, and rewiring a running system]{.en}[DUISE, et recâbler un système en marche]{.fr}[DUISE und das Umverdrahten im Betrieb]{.de} {#sec-duise} + +::: {.en} +The naming scheme finally gets its name: **D**escription (what contracts this service understands and publishes), **U**nit (which instance), **I**ntent (requested behaviour), **S**tatus (what is true now), **E**vent (what happened). + +```text +Tutorial/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted} +``` + +`U/` is what the filesystem never needed: each machine had its own replica of the same relative path, so instance identity was implicit. MQTT has one shared namespace, so a topic must say *which* copy. Hard-coding `U/alice` in a capability is therefore worse than hard-coding `consoleIn.outbox` ever was: it binds the build to one deployment. Configured by Intent, **one build serves everyone** — which is why `MqttConfigure` takes three unit names as arguments. The unit names *are* the topology. + +Rewiring, observed on a running system: publish a new Intent naming a different source topic, and the service unsubscribes from the old one, subscribes to the new one, and republishes `S/subscriptions` to match. No restart, no edit. Send an invalid filter instead — `Tutorial/#/E/text`, where `#` is not the last level — and `MqttTools.isValidFilter` rejects it; the old subscription stands and the Status still tells the truth. + +That rejection exposes a real gap, worth naming rather than hiding: it is logged locally only. The configurator cannot tell whether its Intent was applied or refused, and a monitor cannot distinguish "refused" from "not yet processed". In this design a sender learns the outcome by reading Status and comparing it with what it asked for. Publishing refusals as an Event, or a last-error Status, would close that gap; neither is in the material, so it is a design decision to justify. +::: + +::: {.fr} +Le schéma de nommage reçoit enfin son nom : **D**escription (quels contrats ce service comprend et publie), **U**nit (quelle instance), **I**ntent (comportement demandé), **S**tatus (ce qui est vrai maintenant), **E**vent (ce qui est arrivé). + +```text +Tutorial/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted} +``` + +`U/` est ce dont le système de fichiers n'avait pas besoin : chaque machine avait sa réplique du même chemin relatif, l'identité d'instance était implicite. MQTT a un espace de noms partagé : un sujet doit donc dire *quelle* copie. Coder en dur `U/alice` dans une capacité est donc pire que de coder en dur `consoleIn.outbox` : cela lie la compilation à un déploiement. Configuré par Intent, **une seule compilation sert tout le monde** — d'où les trois noms d'unité en arguments de `MqttConfigure`. Les noms d'unité *sont* la topologie. + +Recâblage observé sur un système en marche : publiez un nouvel Intent nommant une autre source, et le service se désabonne de l'ancienne, s'abonne à la nouvelle et republie `S/subscriptions` en conséquence. Sans redémarrage, sans édition. Envoyez au contraire un filtre invalide — `Tutorial/#/E/text`, où `#` n'est pas le dernier niveau — et `MqttTools.isValidFilter` le rejette ; l'ancien abonnement demeure et le Status continue de dire vrai. + +Ce rejet révèle une vraie lacune, à nommer plutôt qu'à cacher : il n'est journalisé que localement. Le configurateur ne peut savoir si son Intent a été appliqué ou refusé, et un moniteur ne peut distinguer « refusé » de « pas encore traité ». Dans cette conception, l'émetteur apprend le résultat en lisant le Status et en le comparant à sa demande. Publier les refus comme Event, ou un Status de dernière erreur, combleraient la lacune ; ni l'un ni l'autre n'est dans le matériel : c'est une décision de conception à justifier. +::: + +::: {.de} +Das Namensschema erhält endlich seinen Namen: **D**escription (welche Verträge dieser Dienst versteht und veröffentlicht), **U**nit (welche Instanz), **I**ntent (gewünschtes Verhalten), **S**tatus (was jetzt gilt), **E**vent (was geschehen ist). + +```text +Tutorial/ROT13/U/alice/{I, S/online, S/subscriptions/text, E/crypted} +``` + +`U/` brauchte das Dateisystem nie: jede Maschine hatte ihr eigenes Replikat desselben relativen Pfades, Instanzidentität war implizit. MQTT hat einen gemeinsamen Namensraum, ein Topic muss also sagen, *welche* Kopie. `U/alice` in einer Fähigkeit festzuschreiben ist daher schlimmer, als `consoleIn.outbox` es je war: es bindet das Build an ein Deployment. Per Intent konfiguriert, **dient ein Build allen** — daher die drei Unit-Namen als Argumente von `MqttConfigure`. Die Unit-Namen *sind* die Topologie. + +Umverdrahten, am laufenden System beobachtet: einen neuen Intent mit anderer Quelle veröffentlichen, und der Dienst kündigt die alte, abonniert die neue und veröffentlicht `S/subscriptions` passend neu. Kein Neustart, keine Änderung. Schickt man stattdessen einen ungültigen Filter — `Tutorial/#/E/text`, wo `#` nicht die letzte Ebene ist — weist `MqttTools.isValidFilter` ihn ab; das alte Abonnement bleibt, und der Status sagt weiter die Wahrheit. + +Diese Abweisung legt eine echte Lücke offen, die man benennen und nicht verstecken sollte: sie wird nur lokal protokolliert. Der Konfigurator erfährt nicht, ob sein Intent angewandt oder abgelehnt wurde, und ein Monitor kann „abgelehnt" nicht von „noch nicht verarbeitet" unterscheiden. In diesem Entwurf erfährt ein Sender das Ergebnis, indem er den Status liest und mit seiner Anfrage vergleicht. Abweisungen als Event zu veröffentlichen oder ein Letzter-Fehler-Status würden die Lücke schliessen; beides steht nicht im Material — es ist eine zu begründende Entwurfsentscheidung. +::: + +## [What a new subscriber learns, and what a dead one admits]{.en}[Ce qu'un nouvel abonné apprend, et ce qu'un mort avoue]{.fr}[Was ein neuer Abonnent erfährt und was ein Toter zugibt]{.de} {#sec-retained-and-will} + +::: {.en} +Subscribing to `Tutorial/#` for three seconds, with nothing being published, returns this: + +```text +Tutorial/ROT13/U/nitro5/S/online {"value":true} +Tutorial/ROT13/U/nitro5/S/subscriptions/text "Tutorial/ConsoleIn/U/nitro5/E/text" +Tutorial/ConsoleOut/U/nitro5/S/online {"value":true} +Tutorial/ConsoleOut/U/nitro5/S/subscriptions/text "Tutorial/ROT13/U/nitro5/E/crypted" +``` + +A late arrival learns the entire current wiring of the system, instantly, without asking anyone and without any component knowing a monitor exists. That is retained **Status**. No Events arrive, because Events are published non-retained — "retained State, non-retained Events". It is also the proper answer to the instinct of *asking* a service what it is doing: nobody asks; the service states it, once, and the broker keeps it for whoever turns up. + +Retained Status alone would lie, though. Kill a service with `Ctrl+C` and its `S/online = true` stays on the broker forever. Hence the **Last Will**, registered at connect time: + +```java +var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties()); +options.setWill(lastWillTopic, will); +``` + +The will is **retained**, so when the broker publishes it on the client's behalf it replaces the stale `true`. The component that fails is not the component that reports the failure — which is the only arrangement that can work. One caveat: a clean DISCONNECT does **not** trigger a will, so a well-behaved service publishes `online=false` itself on the way out, and the will covers the ugly deaths. +::: + +::: {.fr} +S'abonner à `Tutorial/#` pendant trois secondes, sans que rien ne soit publié, renvoie ceci : + +```text +Tutorial/ROT13/U/nitro5/S/online {"value":true} +Tutorial/ROT13/U/nitro5/S/subscriptions/text "Tutorial/ConsoleIn/U/nitro5/E/text" +Tutorial/ConsoleOut/U/nitro5/S/online {"value":true} +Tutorial/ConsoleOut/U/nitro5/S/subscriptions/text "Tutorial/ROT13/U/nitro5/E/crypted" +``` + +Un arrivant tardif apprend instantanément tout le câblage actuel du système, sans rien demander et sans qu'aucun composant sache qu'un moniteur existe. C'est le **Status** retenu. Aucun Event n'arrive, car les Events sont publiés non retenus — « State retenu, Events non retenus ». C'est aussi la bonne réponse à l'instinct de *demander* à un service ce qu'il fait : personne ne demande ; le service le déclare, une fois, et le courtier le garde pour quiconque se présente. + +Le Status retenu seul mentirait pourtant. Tuez un service par `Ctrl+C` et son `S/online = true` reste sur le courtier à jamais. D'où la **dernière volonté**, enregistrée au moment de la connexion : + +```java +var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties()); +options.setWill(lastWillTopic, will); +``` + +Elle est **retenue** : quand le courtier la publie au nom du client, elle remplace le `true` périmé. Le composant qui échoue n'est pas celui qui signale l'échec — seul arrangement qui puisse fonctionner. Une réserve : une déconnexion propre ne déclenche **pas** la dernière volonté ; un service bien élevé publie donc `online=false` lui-même en partant, la volonté couvrant les morts brutales. +::: + +::: {.de} +Drei Sekunden `Tutorial/#` abonnieren, ohne dass etwas veröffentlicht wird, ergibt dies: + +```text +Tutorial/ROT13/U/nitro5/S/online {"value":true} +Tutorial/ROT13/U/nitro5/S/subscriptions/text "Tutorial/ConsoleIn/U/nitro5/E/text" +Tutorial/ConsoleOut/U/nitro5/S/online {"value":true} +Tutorial/ConsoleOut/U/nitro5/S/subscriptions/text "Tutorial/ROT13/U/nitro5/E/crypted" +``` + +Ein Spätankömmling erfährt augenblicklich die gesamte aktuelle Verdrahtung des Systems, ohne jemanden zu fragen und ohne dass eine Komponente von einem Monitor weiss. Das ist retained **Status**. Keine Events kommen an, denn Events werden nicht retained veröffentlicht — „retained State, nicht retained Events". Es ist auch die richtige Antwort auf den Reflex, einen Dienst zu *fragen*, was er tut: niemand fragt; der Dienst erklärt es einmal, und der Broker bewahrt es für jeden, der kommt. + +Retained Status allein würde allerdings lügen. Beendet man einen Dienst mit `Ctrl+C`, bleibt sein `S/online = true` für immer beim Broker. Daher der **Last Will**, bei der Verbindung registriert: + +```java +var will = new MqttMessage("{\"value\":false}".getBytes(UTF_8), 1, true, new MqttProperties()); +options.setWill(lastWillTopic, will); +``` + +Der Will ist **retained**, ersetzt also beim Veröffentlichen durch den Broker das veraltete `true`. Die Komponente, die ausfällt, ist nicht die, die den Ausfall meldet — die einzige Anordnung, die funktionieren kann. Ein Vorbehalt: ein sauberes DISCONNECT löst **keinen** Will aus; ein gut erzogener Dienst veröffentlicht daher beim Beenden selbst `online=false`, und der Will deckt die hässlichen Tode. +::: + +## [What survived the transport, and what coupling remains]{.en}[Ce qui a survécu au transport, et le couplage restant]{.fr}[Was den Transport überlebte und welche Kopplung bleibt]{.de} {#sec-coupling-remains} + +::: {.en} +The lower half of the filesystem→MQTT table is the point: `I`, `S`, `E`, egoistic services, runtime topology and "transformer if needed" are **unchanged**. The architecture survived the transport replacement, and that is the strongest available evidence that the architecture was never about the transport. + +Loose coupling does not mean nothing knows anything. What remains, necessarily, is agreement on: message syntax, message semantics, topic contracts, Intent, ownership, the meaning of State and the meaning of Events. The goal is not to eliminate coupling but to **eliminate unnecessary knowledge**. Concretely, in this system each service must understand exactly one foreign Event contract — ROT13 understands ConsoleIn's `E/text`, ConsoleOut understands ROT13's `E/crypted` — plus the Intent schema it accepts on its own `I`. That list is the irreducible minimum. + +Separately, the broker is a shared infrastructure dependency: everyone needs its address and nothing works without it. Real, but a different kind of thing from one component knowing another. + +The step-78 checklist is the tool to keep. Twelve questions, of which these six carry the argument for this system: + +| question | answer here | +|---|---| +| does a capability contain a hard-coded producer identity? | no — it arrives as Intent | +| which foreign contracts must it understand? | one Event contract each, plus its own Intent schema | +| where is topology defined? | in the configurator, outside the data path | +| can topology change without recompiling? | yes — demonstrated on a running system | +| could the transport be replaced? | yes — demonstrated, filesystem then MQTT | +| does every mediator do something that needs mediation? | yes, vacuously: `TEXT → TEXT` needs none, and none exists | + +The material's own caution applies: the answers need not all be "no". They need to be **intentional**. +::: + +::: {.fr} +La moitié inférieure du tableau système de fichiers→MQTT est l'essentiel : `I`, `S`, `E`, les services égoïstes, la topologie à l'exécution et « transformateur si nécessaire » sont **inchangés**. L'architecture a survécu au remplacement du transport, et c'est la meilleure preuve disponible qu'elle n'a jamais dépendu du transport. + +Un couplage faible ne signifie pas que rien ne sait rien. Ce qui reste, nécessairement, est l'accord sur : la syntaxe des messages, leur sémantique, les contrats de sujets, l'Intent, la propriété, le sens du State et celui des Events. Le but n'est pas d'éliminer le couplage mais d'**éliminer la connaissance inutile**. Concrètement, chaque service ici doit comprendre exactement un contrat d'Event étranger — ROT13 comprend `E/text` de ConsoleIn, ConsoleOut comprend `E/crypted` de ROT13 — plus le schéma d'Intent qu'il accepte sur son propre `I`. Cette liste est le minimum irréductible. + +Par ailleurs, le courtier est une dépendance d'infrastructure partagée : tout le monde a besoin de son adresse et rien ne marche sans lui. Réel, mais d'une autre nature que la connaissance d'un composant par un autre. + +La liste de l'étape 78 est l'outil à garder. Douze questions, dont ces six portent l'argument de ce système : + +| question | réponse ici | +|---|---| +| une capacité contient-elle l'identité d'un producteur en dur ? | non — elle arrive par Intent | +| quels contrats étrangers doit-elle comprendre ? | un contrat d'Event chacun, plus son propre schéma d'Intent | +| où la topologie est-elle définie ? | dans le configurateur, hors du chemin des données | +| la topologie peut-elle changer sans recompiler ? | oui — démontré sur un système en marche | +| le transport pourrait-il être remplacé ? | oui — démontré : système de fichiers puis MQTT | +| chaque médiateur fait-il quelque chose qui exige une médiation ? | oui, trivialement : `TEXT → TEXT` n'en exige aucune, et il n'y en a aucun | + +La prudence du matériel s'applique : les réponses n'ont pas à être toutes « non ». Elles doivent être **intentionnelles**. +::: + +::: {.de} +Die untere Hälfte der Tabelle Dateisystem→MQTT ist der Punkt: `I`, `S`, `E`, egoistische Dienste, Topologie zur Laufzeit und „Transformator wenn nötig" sind **unverändert**. Die Architektur überlebte den Transportwechsel, und das ist der stärkste verfügbare Beleg, dass sie nie am Transport hing. + +Lose Kopplung heisst nicht, dass nichts etwas weiss. Notwendig bleibt die Einigkeit über: Nachrichtensyntax, Nachrichtensemantik, Topic-Verträge, Intent, Besitz, Bedeutung von State und Bedeutung von Events. Ziel ist nicht, Kopplung zu beseitigen, sondern **unnötiges Wissen** zu beseitigen. Konkret muss hier jeder Dienst genau einen fremden Event-Vertrag verstehen — ROT13 den `E/text` von ConsoleIn, ConsoleOut den `E/crypted` von ROT13 — plus das Intent-Schema, das er auf seinem eigenen `I` annimmt. Diese Liste ist das unverzichtbare Minimum. + +Davon getrennt: der Broker ist eine geteilte Infrastrukturabhängigkeit; alle brauchen seine Adresse, und ohne ihn läuft nichts. Real, aber anderer Art als das Wissen einer Komponente über eine andere. + +Die Prüfliste aus Schritt 78 ist das Werkzeug, das bleibt. Zwölf Fragen, von denen diese sechs das Argument dieses Systems tragen: + +| Frage | Antwort hier | +|---|---| +| enthält eine Fähigkeit eine festgeschriebene Produzentenidentität? | nein — sie kommt als Intent | +| welche fremden Verträge muss sie verstehen? | je einen Event-Vertrag, plus ihr eigenes Intent-Schema | +| wo ist die Topologie definiert? | im Konfigurator, ausserhalb des Datenpfads | +| kann sich die Topologie ohne Neukompilieren ändern? | ja — am laufenden System gezeigt | +| könnte der Transport ersetzt werden? | ja — gezeigt: Dateisystem, dann MQTT | +| leistet jeder Vermittler etwas, das Vermittlung braucht? | ja, trivial: `TEXT → TEXT` braucht keine, und es gibt keinen | + +Die Mahnung des Materials gilt: die Antworten müssen nicht alle „nein" lauten. Sie müssen **absichtlich** sein. +::: diff --git a/conv/00-setup-and-step-0.md b/conv/00-setup-and-step-0.md index a2077b7..d6672b1 100644 --- a/conv/00-setup-and-step-0.md +++ b/conv/00-setup-and-step-0.md @@ -3,7 +3,7 @@ > ⬅ Previous: *(none)* · [Index](../conv.md) · [Next: Part I ➡](01-part-I.md) > -> All parts: **Setup & Step 0** · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: **Setup & Step 0** · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -309,5 +309,5 @@ java --version > ⬅ Previous: *(none)* · [Index](../conv.md) · [Next: Part I ➡](01-part-I.md) > -> All parts: **Setup & Step 0** · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: **Setup & Step 0** · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/01-part-I.md b/conv/01-part-I.md index 2af51e3..3431863 100644 --- a/conv/01-part-I.md +++ b/conv/01-part-I.md @@ -3,7 +3,7 @@ > [⬅ Previous: Setup & Step 0](00-setup-and-step-0.md) · [Index](../conv.md) · [Next: Part II ➡](02-part-II.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · **Part I** · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · **Part I** · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -740,5 +740,5 @@ Read section 10 (lines 644–694) to see it in the README's words. Note that the > [⬅ Previous: Setup & Step 0](00-setup-and-step-0.md) · [Index](../conv.md) · [Next: Part II ➡](02-part-II.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · **Part I** · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · **Part I** · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/02-part-II.md b/conv/02-part-II.md index d9962d4..f1ce4ab 100644 --- a/conv/02-part-II.md +++ b/conv/02-part-II.md @@ -3,7 +3,7 @@ > [⬅ Previous: Part I](01-part-I.md) · [Index](../conv.md) · [Next: Part III ➡](03-part-III.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · **Part II** · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · **Part II** · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -503,5 +503,5 @@ Each time it moved *away* from the capabilities. It never disappeared. (Bookmark > [⬅ Previous: Part I](01-part-I.md) · [Index](../conv.md) · [Next: Part III ➡](03-part-III.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · **Part II** · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · **Part II** · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/03-part-III.md b/conv/03-part-III.md index 49567a6..2f2a422 100644 --- a/conv/03-part-III.md +++ b/conv/03-part-III.md @@ -3,7 +3,7 @@ > [⬅ Previous: Part II](02-part-II.md) · [Index](../conv.md) · [Next: Part IV ➡](04-part-IV.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · **Part III** · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · **Part III** · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -369,5 +369,5 @@ Explained the decoy directory, and asked for `sudo find / -xdev -name '.stfolder > [⬅ Previous: Part II](02-part-II.md) · [Index](../conv.md) · [Next: Part IV ➡](04-part-IV.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · **Part III** · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · **Part III** · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/04-part-IV.md b/conv/04-part-IV.md index 6878d64..b27bb26 100644 --- a/conv/04-part-IV.md +++ b/conv/04-part-IV.md @@ -3,7 +3,7 @@ > [⬅ Previous: Part III](03-part-III.md) · [Index](../conv.md) · [Next: Part V ➡](05-part-V.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · **Part IV** · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · **Part IV** · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -32,5 +32,5 @@ Corrected the mechanism: nothing is interrupted — `runConsoleIn` returns on EO > [⬅ Previous: Part III](03-part-III.md) · [Index](../conv.md) · [Next: Part V ➡](05-part-V.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · **Part IV** · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · **Part IV** · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/05-part-V.md b/conv/05-part-V.md index 0537de3..aa38bc2 100644 --- a/conv/05-part-V.md +++ b/conv/05-part-V.md @@ -3,7 +3,7 @@ > [⬅ Previous: Part IV](04-part-IV.md) · [Index](../conv.md) · [Next: Part VI ➡](06-part-VI.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · **Part V** · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · **Part V** · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -50,5 +50,5 @@ The count was right and the step's claim holds: **2 application publications** p > [⬅ Previous: Part IV](04-part-IV.md) · [Index](../conv.md) · [Next: Part VI ➡](06-part-VI.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · **Part V** · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · **Part V** · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/06-part-VI.md b/conv/06-part-VI.md index c3e270f..e76432e 100644 --- a/conv/06-part-VI.md +++ b/conv/06-part-VI.md @@ -3,7 +3,7 @@ > [⬅ Previous: Part V](05-part-V.md) · [Index](../conv.md) · [Next: Part VII ➡](07-part-VII.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · **Part VI** · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · **Part VI** · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -85,5 +85,5 @@ Ledger: mediated distributed 4 publications / 5 processes in the data path; dyna > [⬅ Previous: Part V](05-part-V.md) · [Index](../conv.md) · [Next: Part VII ➡](07-part-VII.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · **Part VI** · [Part VII](07-part-VII.md) +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · **Part VI** · [Part VII](07-part-VII.md) · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/07-part-VII.md b/conv/07-part-VII.md index 4763242..ca1873d 100644 --- a/conv/07-part-VII.md +++ b/conv/07-part-VII.md @@ -1,9 +1,9 @@ # Conversation Log — Part VII — Now Merge the Two Architectural Ideas · Steps 48–52 (turns 77–83) -> [⬅ Previous: Part VI](06-part-VI.md) · [Index](../conv.md) · Next: *(not started yet)* ➡ +> [⬅ Previous: Part VI](06-part-VI.md) · [Index](../conv.md) · [Next: Parts VIII & IX ➡](08-part-VIII-IX.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · **Part VII** +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · **Part VII** · [Parts VIII & IX](08-part-VIII-IX.md) --- @@ -71,7 +71,7 @@ Part VII complete: egoistic capabilities, Intent from one authority, a transform --- -> [⬅ Previous: Part VI](06-part-VI.md) · [Index](../conv.md) · Next: *(not started yet)* ➡ +> [⬅ Previous: Part VI](06-part-VI.md) · [Index](../conv.md) · [Next: Parts VIII & IX ➡](08-part-VIII-IX.md) > -> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · **Part VII** +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · **Part VII** · [Parts VIII & IX](08-part-VIII-IX.md) diff --git a/conv/08-part-VIII-IX.md b/conv/08-part-VIII-IX.md new file mode 100644 index 0000000..3c2653f --- /dev/null +++ b/conv/08-part-VIII-IX.md @@ -0,0 +1,86 @@ +# Conversation Log — Part VIII — The Filesystem Has Done Its Job · Step 53, and Part IX — MQTT · Steps 54– (turns 84–) + + +> [⬅ Previous: Part VII](07-part-VII.md) · [Index](../conv.md) · Next: *(not started yet)* ➡ +> +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · **Parts VIII & IX** + + +--- + +## [84] Student + +> Filesystem was great: to apprehend the mehtodology, manage huge amount of file and create backup (if versionning is setup), but is clearly too long for short message, detect the changes (need a scan each times), heavy when the message must be shared with multiple subscribers + +## [84] Tutor — reply + +Step 53's own list, matched — and the versioning caveat was spotted independently: the material says replication alone is not a backup strategy, because deletion and corruption replicate too. What the book adds: the filesystem's advantage MQTT **cannot** match (gigabytes to terabytes, where chunking a huge payload over MQTT means inventing a file-transfer protocol inside a message protocol), hence "use messages for coordination and events, use a file or object store for large data, and let a message carry the **location, identity and metadata**"; the full list of what the transport taught (including independent languages); and the accumulated machinery — directories, `.tmp`, atomic moves, `.msg`, `WatchService`, rescanning, shared paths, Syncthing, delay — behind "the architecture is getting clean, the transport is increasingly ridiculous". The student's "heavy for multiple subscribers" is the Step 3 queue-versus-topic limitation resurfacing as a transport problem. + +## [85] Student + +> I don't expect it to change the logic behind the architecture, i.e. the event driven with the subscription to topic and so on, i instead expect it to change _how_ the subscription and mailling works, by replacing the file system with a lightweighten "software/process" that handle short message + +## [85] Tutor — reply + +Every row of Step 54's mapping table, predicted before reading it: board root → broker/namespace, directory → topic, `.msg` → publication, contents → payload, `WatchService` → subscription, dynamic directory → topic filter, control/state/event directories → `I`, `S/…`, `E/…`. The section's punchline is that reaction itself: "Oh. We already know this architecture." MQTT is a transport change, not an architectural claim. Local tooling checked: `mosquitto 2.1.2` with `mosquitto_pub`/`mosquitto_sub` already installed on the laptop. + +## [86] Student + +> how to install it on my server? i'll need it for my project + +## [86] Tutor — reply + +Gave both routes for the home server (Docker Compose, matching how its other services run, and the native package), with the Mosquitto 2.x trap spelled out: since 2.0 it listens on localhost only and refuses anonymous clients unless told otherwise, so a `listener` line and an explicit `allow_anonymous` or a password file are required for the laptop, the phone or the vehicle to connect. Noted that port 1883 is unencrypted and belongs on the home LAN only, never exposed to the internet. + +**Progress record** +- Current step: 55 (Part IX); Part VIII closed +- Last observed result: `mosquitto 2.1.2` present on the laptop; the server has nothing yet +- Unresolved problem: Part VIII chapter placement (own file or folded into the MQTT chapter) +- Next action: student installs Mosquitto on the server, then runs the Step 55 publish/subscribe experiment + +--- + +## [87]–[108] Student & Tutor — Part IX, steps 55 to 78 + +Condensed, one line per exchange; the full reasoning is in the chapter `08-part-ix-mqtt.qmd`. + +- **[87]** "the line was added to host, and i've tested and MQTT works well" — `/etc/hosts` entry added for the server; broker reachable. Verified independently with a publish/subscribe round trip. +- **[88]** Step 55 observations: a publication made before subscribing never arrives; `test/#` matches `test/a` and `test/a/b/c` but not `testing/x`, "due to which outbox the sub is listening". ✅ both, with two corrections: a topic is **not** a container (a routing key matched at publish time, not a place where messages sit), and `#` works on levels, not string prefixes, with `+` as the single-level form. Forward link: retained messages answer the late-subscriber case (step 71). +- **[89]** "is it normal that `mvn -q dependency:resolve` return nothing?" — yes: `-q` prints only warnings and errors. Verified Paho 1.2.5 and Jackson 2.22.2 in `~/.m2`. +- **[90]** Client id "to avoid duplicate"; broker address "should come from the configurator, not hardcoded". Second half ✅ and confirmed by the code (`System.getProperty("mqtt.broker", …)`), with the bootstrapping asymmetry added: the broker address is the one thing that cannot arrive as Intent. First half corrected: uniqueness is a symptom; the id is **session identity** — the broker keeps subscriptions, QoS>0 queues and the Last Will association under it. +- **[91]** "i don't really see any message that should be retained" — correct for the system as it stood, and the gap is the point: it published no Status. The course code retains `S/online` and `S/subscriptions` and publishes Events non-retained. +- **[92]** Step 59–60: no more scanning, just wait; careful because callbacks are asynchronous. ✅ with the hazards named — the callback runs on the client's MQTT thread, `waitForCompletion()` inside it deadlocks, escaping exceptions break delivery — and the observation that this is why `FileSubscriptions` used a queue. +- **[93]** Ownership per service listed correctly (ConsoleIn publishes `E/text`; ROT13 owns `I`, `S/…`, `E/crypted`; ConsoleOut owns `I`, `S/…`). Nobody gained knowledge. Noted that ConsoleOut owns no `E`, and that `U/` is what lets two instances coexist. +- **[94]** "what do you mean by unit name?" — the `U` level: which concrete instance. `MqttConfigure` takes three unit names, and those names *are* the topology. +- **[95]** `Connection refused` from `MqttRot13` — no broker on the laptop (port 1883 closed locally, open on the server). Fixed with `-Dmqtt.broker=tcp://homeserver:1883` **before** the class name. +- **[96]** "it works now, got the Tutorial topics in the subscriber". A three-second subscribe with nothing publishing returned four retained Status messages and no Events — retained State, non-retained Events, demonstrated. +- **[97]** Before `MqttConfigure`, each service announced its `I` topic and idled. Then: "i should have build a verifier asking if the Intent has been received" — the asking reflex again; corrected: `S/subscriptions` already reports the **effect**, and an Intent that was rejected would not appear there. The filesystem could show messages, never state. +- **[98]** Why hard-coding `Tutorial/ConsoleIn/U/alice/E/text` is worse than hard-coding a mailbox name: it bakes in a **unit**, where the filesystem's relative paths made instance identity implicit per replica. Consequence added: one build then serves only one deployment. +- **[99]** Step 63: "we want richer intent, doing it manually is undoable" — that is the step's conclusion; its premise is that `TOPIC some/path` has one field, one meaning, no nesting and nothing to validate against. +- **[100]** The two Jackson mappers: "one serialises, one deserialises" — the names, not the reason. Reading uses a **YAML** factory with unknown properties tolerated; writing uses strict indented JSON. Tolerant in, strict out. +- **[101]** "rot13 just has to send a request and the broker manage it" ✅ — and the consequence: the broker owns the subscription list, no third party can query it, so `S/subscriptions` is the component's own declaration, published so the architecture knows what the transport hides. +- **[102]** "i'm a bit lost with all the files in 06" — file map given (four programs, two helpers) plus the runtime-rewiring recipe with a second ConsoleIn under another unit. +- **[103]** Rewiring confirmed on a running system; the invalid filter produced a local log line. Verified from the retained Status that `S/subscriptions` had moved to the new source and that the rejection left it untouched. Gap named: rejections are invisible to the architecture. +- **[104]** Last Will: `Ctrl+C` leaves `online=true` for late monitors; the will lets the broker publish `false`. ✅ with three additions — the will is **retained** (replacing the stale `true`), it is registered at connect time, and a clean DISCONNECT does not trigger it. +- **[105]** `D` is the description of what a service accepts and publishes; unnecessary so far because three self-explanatory services and one human did the wiring. Sharpened: `D` makes the Part VII compatibility rule machine-checkable. +- **[106]** Compatibility test `type(out) == type(in)` — necessary but not sufficient: compatibility is semantic (Celsius versus Fahrenheit type-check identically). What MQTT changes: deciding is now observable (live traffic, `D`), and inserting a transformer is additive and invisible to the producer. +- **[107]** "there is still coupling done by the broker" — corrected: the remaining coupling is **agreement on meaning** between components (syntax, semantics, topic contracts, Intent, ownership, State and Event meaning). The broker is a shared infrastructure dependency, a different kind of thing. +- **[108]** Step 78 checklist answered for the running system. Corrections: no hard-coded producer identity (it arrives as Intent); "foreign contract" means one owned by someone else, and here it is one Event contract per service plus its own Intent schema; and question 12 reads the other way round — with no mediators at all, it passes vacuously. + +## Part IX — chapter written + +`08-part-ix-mqtt.qmd` covers Part VIII and Part IX up to step 78, in all three languages: the filesystem's verdict, the mapping table, Paho and the client id, structured Intent and the two mappers, DUISE with the runtime rewiring and its rejection gap, retained Status with the Last Will, and the coupling that remains with the six checklist answers. + +**Progress record** +- Current step: Part IX read through step 78; steps 79 and 81 left to read, step 80 is the student's own project +- Last observed result: MQTT chain running against the server's broker; rewiring and rejection both observed; retained Status verified twice +- Unresolved problem: rejections invisible to the architecture (a design decision for the report) +- Next action: the student starts the graded project (step 80); steps 79 and 81 remain as reading + +--- + + +> [⬅ Previous: Part VII](07-part-VII.md) · [Index](../conv.md) · Next: *(not started yet)* ➡ +> +> All parts: [Setup & Step 0](00-setup-and-step-0.md) · [Part I](01-part-I.md) · [Part II](02-part-II.md) · [Part III](03-part-III.md) · [Part IV](04-part-IV.md) · [Part V](05-part-V.md) · [Part VI](06-part-VI.md) · [Part VII](07-part-VII.md) · **Parts VIII & IX** +