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 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.