Reading Time: 4 minutes

As discussed recently in this blog, web streaming APIs are a hot topic. One goal of streaming APIs is to reduce polling and replace it with resource efficient event-driven content distribution mechanisms.

With PubSub Huddle meetup happening in London today (unfortunately, I couldn’t go), it seems like good timing to tell you what we’ve done with one of the recently proposed protocols, PubSubHubbub (aka PuSH). It’s a publish/subscribe protocol for the web, using standards like ATOM, RSS and HTTP. It is therefore a very attractive option for integrating systems over the Internet, as it delivers the promises of more complex messaging systems but without the cost of complexity.

latest report
Learn why we are the Leaders in API management and iPaaS

The good news is that Mule can now act as a Hub, the key component in the PubSubHubbub architecture, thanks to a brand new module. You’re just a tiny bit of configuration away from running your own Hub and kiss goodbye to polling!

PubSubHubbub Principles

As shown in the Google presentation above, the principles involved in PubSubHubbub are very simple:

  • Subscribers declare interest in particular topics,
  • Publishers produce content in these topics,
  • Hubs do the heavy lifting of handling subscriptions and content delivery.

Let’s see how Mule can be configured to play the role of a PubSubHubbub hub.

Using Mule as Hub

As always, a little bit of XML is needed:

But that is all you need! With this in place, Mule is now a hub capable of handling subscription requests and publisher content delivery.

If you wonder about the object store, any implementation of can be used as a back-end for the hub. You’ll want to use a persistent one, like the Redis-backed Object Store, to have your hub subscriptions survive a Mule restart!

By default, the hub will retry failed operations (like confirming a subscription) every 5 minutes and a maximum of 12 times. This is configurable, as is the default lease time used when a subscriber does specify it:

More Info

You can try it for yourself by getting the latest source code (see below link) and deploying a hub on Mule 3.2.

  • PubSubHubbub Module for Mule 3.2 GitHub Repository
  • Downloadable Resources

Follow: @rossmason@mulejockey