Managing Stateful Components
Most applications will rely on stateful external resources such as database connections and queues. These resources often have a life cycle associated with them. Typically, we would like to start such resources when the application initializes and stop them when it shuts down.
One popular approach for managing stateful resources in object-oriented languages is to use a dependency injection framework. This approach can also be used in Clojure using the Component library. It’s a solid approach. One major downside is that it requires us to structure our app around it.
Another problem with Component is that stateful resources are described using protocols. This doesn’t play well with the REPL workflow, because ...