O'Reilly logo

Clojure Applied by Alex Miller, Ben Vandgrift

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required