SlideShare a Scribd company logo
Streaming API with Java
Developer Track
David Messinger, Community Architect, Appirio
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
 product or service availability, 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, new products and services, 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-Q for the most recent fiscal quarter ended July 31, 2012. This
 documents and others containing important disclosures 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 presentations, 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.
David Messinger
Community Architect
Appirio
CloudSpokes


@dmessing
http://blog.cloudspokes.com
What to Walk Away With

 • What is Streaming and when do we use it?
 • Configuring Salesforce for Streaming
 • Creating a Java client on Heroku for Streaming
Agenda

  History of Streaming
  Why use Streaming?
  Examples of Streaming
  Demo
    Salesforce.com
    Java Code
  Q/A
History
HTTP
Bayeaux/CometD




           HTTP Way Web
            Two Streaming
          HTTP Server Push
             Reverse Ajax
              Ajax Push
              Bayeaux
CometD examples
Web Sockets

 HTML5
 Advantages
   Maintains connections
   Great for Real Time Communication
   Smaller header
 Disadvantages
   Costly to open and maintain connections
   Evolving Specifications
Web Socket Implementat




 Pat Patterson’s Blog on Pusher, APEX and VF
What is the Streaming API?

 Clients make a single request
 Receive continuous stream of updates from a server
   Publish / Subscribe
   Push Technology
 Near Real Time communication
 Stop Polling now!
Polling vs Streaming

 Polling
   REST/SOAP
   API Limits


 Streaming
   One connection
   Get data when it happens
Why is it Great!

 Don’t worry about relevance
    Queries != Clients
 Event Dispatcher
    Don’t worry about complex code
 Don’t worry about Sharing and Security
    All the benefits of SFDC!
Where would use Streaming

 Big Deal Alerts
 Leaderboard
 Feedback results
 New leads
 Data sync
   Back up Data
   Sync
 Turn by Turn games
Enough Slides!
Create a Topic
PushTopic pushTopic = new PushTopic();
pushTopic.ApiVersion = 25.0;
pushTopic.Name = 'AllAMSEmailsTriggerTest';
pushTopic.Description = 'All records for the AMS_Email_Trigger object';
pushtopic.Query = 'SELECT Id, Name, AMS_Email__c FROM
AMS_Email_Trigger__c';
insert pushTopic;
System.debug('Created new PushTopic: '+ pushTopic.Id);
Questions?
Photo Credits

More Related Content

Streaming API with Java

  • 1. Streaming API with Java Developer Track David Messinger, Community Architect, Appirio
  • 2. 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 product or service availability, 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, new products and services, 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-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures 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 presentations, 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.
  • 4. What to Walk Away With • What is Streaming and when do we use it? • Configuring Salesforce for Streaming • Creating a Java client on Heroku for Streaming
  • 5. Agenda History of Streaming Why use Streaming? Examples of Streaming Demo  Salesforce.com  Java Code Q/A
  • 8. Bayeaux/CometD HTTP Way Web Two Streaming HTTP Server Push Reverse Ajax Ajax Push Bayeaux
  • 10. Web Sockets HTML5 Advantages  Maintains connections  Great for Real Time Communication  Smaller header Disadvantages  Costly to open and maintain connections  Evolving Specifications
  • 11. Web Socket Implementat Pat Patterson’s Blog on Pusher, APEX and VF
  • 12. What is the Streaming API? Clients make a single request Receive continuous stream of updates from a server  Publish / Subscribe  Push Technology Near Real Time communication Stop Polling now!
  • 13. Polling vs Streaming Polling  REST/SOAP  API Limits Streaming  One connection  Get data when it happens
  • 14. Why is it Great! Don’t worry about relevance  Queries != Clients Event Dispatcher  Don’t worry about complex code Don’t worry about Sharing and Security  All the benefits of SFDC!
  • 15. Where would use Streaming Big Deal Alerts Leaderboard Feedback results New leads Data sync  Back up Data  Sync Turn by Turn games
  • 17. Create a Topic PushTopic pushTopic = new PushTopic(); pushTopic.ApiVersion = 25.0; pushTopic.Name = 'AllAMSEmailsTriggerTest'; pushTopic.Description = 'All records for the AMS_Email_Trigger object'; pushtopic.Query = 'SELECT Id, Name, AMS_Email__c FROM AMS_Email_Trigger__c'; insert pushTopic; System.debug('Created new PushTopic: '+ pushTopic.Id);