Push Web Integration with Mule and PubSubHubbub

September 22 2011

3 comments 0
motif

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

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 org.mule.util.store.PartitionableObjectStore 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.

Follow: @rossmason@mulejockey


We'd love to hear your opinion on this post

3 Responses to “Push Web Integration with Mule and PubSubHubbub”

  1. This is very useful capability of MuleESB. I´d like to have an configuration example for notifying to several subscribers.

    Do you have one?

    Agree(0)Disagree(0)Comment
  2. David, subscribers subscribe directly to the Hub using the PubSubHubbub protocol. There is no particular configuration to set up. Feel free to ask more questions and provide further feedback.

    Agree(0)Disagree(0)Comment
  3. […] recently introduced PubSubHubbub module opened the door to server-push web-based integration with Mule. This approach, which is more […]

    Agree(0)Disagree(0)Comment