-
Book Overview & Buying
-
Table Of Contents
Design Patterns and Best Practices in Rust
By :
In this chapter, we'll explore architectural patterns by building Samsa, a producer/consumer (also called pub/sub for "publish/subscribe") microservice. The name is a nod to Gregor Samsa, the protagonist of Franz Kafka's The Metamorphosis; our Samsa borrows its architecture from the distributed streaming platform that shares the author's name. We use the term microservice loosely: our implementation is entirely in-memory, focusing on design patterns rather than networking or deployment. Chapters 10 through 12 continue building on Samsa, applying additional Rust patterns to the same codebase.
Architectural patterns operate at a higher level than the design patterns we've seen so far, shaping how entire systems are organized. In Rust, these patterns are particularly important because the language's ownership system works best when we design with clear data flows, contained mutability, well-defined module boundaries...