Implementing with Component

For each component, we need to consider the required configuration, runtime state, and connections to other components. Once we’ve defined our components and their life-cycle methods, we’ll see how to assemble the components into a running system.

Let’s start with the social media feeds. Each feed needs authentication configuration to connect to the feed. Depending on the system, this can be a username, password, or other access key. We’ll also maintain some runtime state as to whether the feed should be active or paused. Finally, we expect to push new messages on a core.async channel and receive outgoing messages on another channel. We define our component as a record with this information:

 
(​defrecord​ Feed [auth ...

Get Clojure Applied now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.