Extend - Retrieve data in real time with the Force.com streaming API


Published on

Published in: Business, Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Extend - Retrieve data in real time with the Force.com streaming API

  1. 1. Retrieve Data in Real Time with theForce.com Streaming APIAlex ToussaintDirector, Platform API Servicesatoussaint@salesforce.com @alextoussaint
  2. 2. Safe HarborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of theassumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed orimplied by the forward-looking statements we make. All statements other than statements of historical fact could bedeemed forward-looking, including any projections of subscriber growth, earnings, revenues, or other financial items andany statements regarding strategies or plans of management for future operations, statements of belief, any statementsconcerning new, planned, or upgraded services or technology developments and customer contracts or use of ourservices.The risks and uncertainties referred to above include – but are not limited to – risks associated with developing anddelivering new functionality for our service, our new business model, our past operating losses, possible fluctuations inour operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, theoutcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, theimmature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivateour employees and manage our growth, new releases of our service and successful customer deployment, our limitedhistory reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Furtherinformation on potential factors that could affect the financial results of salesforce.com, inc. is included in our annualreport on Form 10-K for the most recent fiscal year ended January 31, 2010. This documents and others are availableon the SEC Filings section of the Investor Information section of our Web site.Any unreleased services or features referenced in this or other press releases or public statements are not currentlyavailable and may not be delivered on time or at all. Customers who purchase our services should make the purchasedecisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does notintend to update these forward-looking statements.
  3. 3. Agenda§  The world is going Real Time!§  Use Cases§  Streaming API§  Tips§  Q&A
  4. 4. Real-Time Force Initiative User Systems Integration(Client Apps, Social Feeds, High (Telco Apps, Internet of (Connecting Applications Fidelity Interaction) Things, ) and Data Sources)
  5. 5. Use Cases Call Center Integration Social Commerce &Enable Call Center Provide real time Power Social and AuctionsApps to provide real notifications and data Mobile apps to Enable Commercetime updates to updates from received streaming show real timeservice agents. Salesforce. updates for real time inventory and social data. promotion related Eliminate data polling required to information – synchronize data. JetStream.
  6. 6. Moving towards Real Time cloud SFDC: Real Time Services User Interaction Analytics Integration Internet of Presence things Collection of API Services
  7. 7. Streaming API
  8. 8. Based on Open Technologies §  Streaming API is GA! §  Using cometD – open client technology §  Relevancy matching is done within the save transaction – continuous queries –  Events are processed by each appserver in bulk, every ~3 seconds. –  Does not consume API call limits §  Start developing now! J
  9. 9. When would I use streaming?§  If you are currently polling our services –  Get data only when it changes§  To receive real-time notification of new or updated data –  Taking action on change in state – e.g. send alert –  Synchronize state – e.g. update page in browser
  10. 10. Streaming vs Polling§  Streaming §  Polling –  Client connects and –  Client must repeatedly call receives near real-time API updates –  SOAP/REST APIs –  Bayeux protocol –  Each poll consumes at –  It does not consume API least one API call (even if calls data not available you –  Count Events and pay) Connections
  11. 11. Streaming vs Triggers§  Streaming §  Trigger + future –  Client connects and –  Server must expose receives near real-time endpoint to receive updates messages (not firewall –  Client can be any app that friendly) can talk HTTP – server –  Trigger is executed on process, JavaScript in data modification; may call browser etc. web service via ‘future’ –  Bayeux protocol method –  SOAP/REST APIs
  12. 12. Streaming API - Lifecycle§  Administrator creates a topic based on a SOQL query –  Recommend wide queries for higher fidelity§  Client applications subscribe via the Bayeux protocol –  CometD library in several languages§  Client applications receive notifications on creates and updates that match Topic query§  One event may get generate and sent to N clients –  We count delivered events
  13. 13. Streaming API - Logical Flow Data Changes Processing Updates NotificationsSalesforce.com Account App Server 1.  Relevance Checks Contacts Manage 2.  Push Notification Processor Leads Subscriptions 3.  Event Dispatch Opportunities Send 4.  Query, CRUD, FLS SharingCustom Objects Updates
  14. 14. Create a topic§  Apex or API§  Create PushTopic standard object –  ApiVersion, Name, Query are required fields PushTopic pushTopic = new PushTopic(); pushTopic.ApiVersion = 2x.0; pushTopic.Name = ’NewContacts; pushtopic.Query = SELECT Id, Name, Email FROM Contact; insert pushTopic;
  15. 15. Subscribe via Bayeux protocol§  Endpoint https://hostname/cometd –  Hostname is Force.com instance URL or Visualforce server hostname§  MUST set sid (session ID) cookie on request $.cometd.init(https://c.na1.visual.force.com/ cometd); var subscription = $.cometd.subscribe(/NewContacts, function(message) { $(#content).append(<p>New record: + JSON.stringify(message.data.Name) + </p>); });
  16. 16. Bayeux Implementations§  CometD client libraries exist for JavaScript and Java – cometd.org§  Implementations also exist for other popular languages –  Ruby –  Node.js –  Dojo –  jQuery –  PHP –  Perl
  17. 17. Service Cloud & Streaming APIMichael RamseySr. Director, Salesforce - Service Cloud
  18. 18. Service Cloud ConsoleUniversal Desktop for the Social Enterprise Contextual •  Relevant •  Timely •  Sufficient Configurable Integrated UI and Component 3rd Party Application Framework & Data Integration Agent Push Experience Platform Avoid Navigating & & Integrate Partner & Searching Channel Solutions Productivity
  19. 19. Service Cloud ConsolePush Notifications§  Auto Refresh Enhanced List Views§  Visually Markup Rows and Columns§  Auto Refresh Detail Pages§  Insert Message to Alert Users to Changes
  20. 20. Spring ‘12Push Notifications: List Views GA
  21. 21. Spring ‘12Push Notifications: List Views GA
  22. 22. Spring ‘12Push Notifications: List Views GA
  23. 23. UCSF Customer Project
  24. 24. Chatter For Health Integration Architecture!
  25. 25. Chatter For Health Message Flow! 1.  Trigger creates “External_Message__c”" 1 record" 2.  Mule iON subscribes to Streaming API topic on “External_Message__c” Object 3.  Mule sets status on record to “In Progress”" 4.  Mule iON routes message to Amcom paging system or Twilio depending on 5 2 Destination__c field" 3 5.  Mule iON sends message back to Salesforce with “Sent” if successful or “Undelivered” if error, affixes error log" 4
  26. 26. Tips
  27. 27. Developing with Streaming API§  Leverage existing CometD libraries –  Existing Java, Javascript, Ruby, etc…§  Use Firebug or equivalent to help debug –  See the protocol in action, help learn behavior§  You can listen to multiple Topics at once –  One connection can listen to N topics§  Make wide queries allow for Sharing to filter –  Get all accounts, sharing will filter per user
  28. 28. Resources§  Force.com Streaming API –  http://developer.force.com§  Getting Started with the Force.com Streaming API –  http://wiki.developerforce.com/page/Streaming_API§  The Bayeux Protocol –  http://svn.cometd.com/trunk/bayeux/bayeux.html§  Discussion Groups –  http://boards.developerforce.com/t5/Streaming-API-Developer- Preview/bd-p/streamingapi
  29. 29. Need more limits – contact us!§  Customers may need more Events or Connections –  Contact Salesforce Support§  We are exploring increase overall limits for Streaming –  More Connections –  More Events –  What is your feedback?
  30. 30. Q&A
  31. 31. Thank You.