Managing Stateful Components
Most applications rely on stateful external resources, such as database connections and queues. These resources often have a life cycle associated with them. Typically, we’d like to start such resources when our application initializes and stop them when it shuts down.
To facilitate a REPL-driven workflow, Luminus uses the Mount library to manage the life cycle of stateful resources in the application. This library treats resources as variables bound to namespaces—an approach that allows Mount to automatically infer the order that the components need to be started from the namespace hierarchy. Naturally, this means that we should be careful with how we access these variables.
Conceptually, Mount takes the approach ...
Get Web Development with Clojure, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.