Chapter 12. Publish and Subscribe

The trouble with being punctual is that there’s nobody there to appreciate it.

—Franklin P. Jones

The traditional guidelines for the use of RSS feeds present a small problem. There is always going to be a balance between the need to be up-to-date and the need to refrain from abusing the feed publisher’s server by requesting the feed every few seconds. While the norm is to request the feed a maximum of once an hour, many feeds deserve following much more closely. Conversely, many feeds update only once a day, or less often. Requesting those once an hour is a waste of time and resources and potentially expensive for the publisher. In this chapter, we look at the two systems currently prescribed for RSS feeds to solve these problems.

Introducing Publish and Subscribe

The problems of efficient delivery of information have existed for far longer than RSS has, as have techniques for addressing them. Indeed, both the systems described in this chapter follow the classic Gang of Four “Observer” design pattern. It is perhaps from the other title of this pattern that the name of the technique arises: Publish and Subscribe.

Let’s think of the situation from above. We have a feed, and this feed has its users. The users take the feed and do what they will — we’ve already seen some examples of potential uses in the previous chapters — but each of the users depends on his copy of the feed (whether in memory, or converted to another format and saved) being up-to-date. ...

Get Content Syndication with RSS 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.