The Salesforce Streaming API has been out for a while, and it can do some crazy great things.

But have you — yes, you — have you actually tried it?

Unless you’ve had a specific use case, it’s possible that you, like me, had nodded along a bit and promised yourself you’d get to it when you had a few spare cycles.

Well my friend today is your lucky day, because I have created the simplest possible Streaming API Example for your enjoyment.

Getting started is easy:
 

  1. Make sure you are working in a developer org.
  2. Install the unmanaged package.
  3. Select the new app, LAB Streaming API Demo.
  4. Click the Insert a Push Topic Button.
  5. Login to the same account on a different browser and start inserting or updating accounts.

 

Voila!  You can now see the Streaming API in action.  Feel free to modify the code and play around as you like.  Try it with Opportunities instead of Accounts.  Try it with more fields.  (Be sure to update the PushTopic or insert new ones using the Dev Console or Workbench.) Put some processing on the front end rather than displaying it as is.  You get the idea.  You’ll also want to check out the docs for details on supported and unsupported query types.

And for next steps, be sure to check out the inimitable Pat Patterson’s Event Driven Programming session from DF11 to get more ideas on how you can use it.

tagged , Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • http://twitter.com/forceguru Ankit Arora

    Super cool. I’ve also tried something while back: http://forceguru.blogspot.in/2012/12/streaming-apis-easy-code.html

    • http://twitter.com/ReidCarlberg Reid Carlberg

      I love it. When I was trying based on instructions similar to those, I got a little hung up on the correct js to extract from the WAR. I also get a little OCD around Static Resources — uploading four different ones kinda made my eye twitch. :-) So that was my main motivation here. You should keep posting examples. Love seeing them.

  • Mitesh Sura

    Is there a way to subscribe to certain push topics? This is what I am thinking, have a VF page with all push topics and let user subscribe to those and choose how frequently they want to be notified via email?

    • http://twitter.com/ReidCarlberg Reid Carlberg

      I bet you could work that out. You’d simply make the subscription JS dynamic based on whatever push topic name/url you needed. What do you mean by “notified by email”?

  • Icecube

    Thanks for the article. Text is great as u have posted basics also. Streaming have become very important.

    Streaming