We launched our Streaming Chatter Feeds challenge to build an application that streams a salesforce.com user's chatter feed to the browser using the Force.com Streaming API and CometD. Sure, we could have done this by polling the Chatter objects but we wanted to be cool. Unfortunately salesforce.com does not allow you to create PushTopic with Chatter objects. Needless to say... we were sad at this discovery. However, the crowd comes through once again riding in on a mighty surfboard and saves the day!
We had two submissions that were worthy of money and took totally different routes to achieve the same results.
First, peakpado built his entry in Java using RabbitMQ on Heroku (take a peek at his video). Since Chatter doesn’t support the streaming API, he created three triggers on the Chatter objects. When Chatter is created, the trigger creates one entry on the custom object Chatter_Stream__c, where PushTopic is listening on. Whenever Chatter_Stream__c object is created, it’s streamed down to the streaming clients. This user_id is used to filter the Chatters for user so that only chatters belongs to the user is published to the client. It also queries group membership, so only chatter from the group user belongs to is published to the client.
Avidev9 went the 100% salesforce.com route using Visualforce and calling back to itself using the REST API for chatter from an iframed Visualforce page. Very ingenious!
|peakpado - video|