Urgent.News

What's breaking now, across thousands of outlets.

Tech

Building Distributed Systems in Elixir: Part 8 — Publish / Subscribe

In the previous part of this series, we built a Worker Pool from scratch. We saw how a coordinator process could distribute pending jobs one by one to a pool of available workers, strictly bounding concurrency and establishing demand-driven coordination: Job 1 ---> [ Coordinator ] ---> Worker 1 Job 2 ---> [ Coordinator ] ---> Worker 2 Every interaction in that system was 1-to-1 (point-to-point) :…

In the previous installment of this series, we crafted a Worker Pool from scratch, illustrating how a coordinator process could judiciously distribute pending jobs among a pool of available workers, safeguarding concurrency and fostering demand-driven coordination. Every interaction in that system was strictly one-to-one, with the coordinator assigning a single job to precisely one worker process.

However, when an event must be received by multiple independent components simultaneously, a different approach is required. Imagine a web application or distributed backend: upon a customer completing a checkout, the Inventory Service must revise stock levels, the Email Service must dispatch a confirmation receipt, the Fraud Detection Service must scrutinize transaction velocity, and the Analytics Service must log the conversion event.

If the order-processing process needed to directly inform every one of those services, the system would become tightly coupled, vulnerable to failure, and challenging to extend. In this segment, we shall construct a Publish / Subscribe (PubSub) Broker from the ground up using rudimentary process primitives: spawn, send, and receive.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Building a hardened personal Linux OS with only proven tools, and why I ultimately abandoned cryptographic rootfs protection

I build a defensive security app for Linux called RoamSwitch as an independent developer. Lately I've been going a step further and building a hardened Linux OS from scratch, RoamSwitch OS.

  • Reporter constructs defensive security application RoamSwitch OS
  • Uses proven tools like AppArmor, fapolicyd, auditd, Falco/Tetragon, Landlock, AIDE and TPM2
  • Abandoned cryptographic rootfs protection for research purposes

More from Monday 14 September →