extend - retrieve data in real time with the force.com streaming api
DESCRIPTION
TRANSCRIPT
Retrieve Data in Real Time with the Force.com Streaming API
@alextoussaint
Alex Toussaint Director, Platform API Services [email protected]
Safe Harbor Safe 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 the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year ended January 31, 2010. This documents and others are available on 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 currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
Agenda
§ The world is going Real Time! § Use Cases
§ Streaming API
§ Tips
§ Q&A
Real-Time Force Initiative
User (Client Apps, Social Feeds, High
Fidelity Interaction)
Systems (Telco Apps, Internet of
Things, )
Integration (Connecting Applications
and Data Sources)
Social Call Center Enable Call Center Apps to provide real time updates to service agents.
Power Social and Mobile apps to received streaming updates for real time social data.
Integration Provide real time notifications and data updates from Salesforce.
Eliminate data polling required to synchronize data.
Use Cases
Commerce & Auctions Enable Commerce show real time inventory and promotion related information – JetStream.
Moving towards Real Time cloud
User Interaction
SFDC: Real Time Services
Internet of things
Presence Integration Analytics
Collection of API Services
Streaming API
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
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
Streaming vs Polling
§ Streaming – Client connects and
receives near real-time updates
– Bayeux protocol
– It does not consume API calls
– Count Events and Connections
§ Polling – Client must repeatedly call
API
– SOAP/REST APIs
– Each poll consumes at least one API call (even if data not available you pay)
Streaming vs Triggers
§ Streaming – Client connects and
receives near real-time updates
– Client can be any app that can talk HTTP – server process, JavaScript in browser etc.
– Bayeux protocol
§ Trigger + future – Server must expose
endpoint to receive messages (not firewall friendly)
– Trigger is executed on data modification; may call web service via ‘future’ method
– SOAP/REST APIs
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
Streaming API - Logical Flow
Salesforce.com Account Contacts
Leads Opportunities
Custom Objects
App Server Manage
Subscriptions Send
Updates
1. Relevance Checks 2. Push Notification Processor 3. Event Dispatch 4. Query, CRUD, FLS Sharing
Data Changes Processing Updates Notifications
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;
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>');
});
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
Service Cloud & Streaming API Michael Ramsey Sr. Director, Salesforce - Service Cloud
Service Cloud Console Universal Desktop for the Social Enterprise
Agent Experience
& Productivity
Push Avoid Navigating &
Searching
Configurable UI and Component
Framework
Contextual
• Relevant • Timely • Sufficient
Integrated 3rd Party Application & Data Integration
Platform Integrate Partner & Channel Solutions
Service Cloud Console Push Notifications
§ Auto Refresh Enhanced List Views
§ Visually Markup Rows and Columns
§ Auto Refresh Detail Pages
§ Insert Message to Alert Users to Changes
Push Notifications: List Views Spring ‘12
GA
Push Notifications: List Views Spring ‘12
GA
Spring ‘12
GA
Push Notifications: List Views
UCSF Customer Project
Chatter For Health Integration Architecture!
Chatter For Health Message Flow!
1. Trigger creates “External_Message__c”" 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 Destination__c field"
5. Mule iON sends message back to Salesforce with “Sent” if successful or “Undelivered” if error, affixes error log"
1
5
4
3
2
Tips
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
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
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?
Q&A
Thank You.