Barcode reader in the our Airport vip lounges is triggering a REST Service in our Salesforce service org and after that the screen of the vip lounges should get refreshed with the information of the clients boarding cards.

Technically what it is happening is:

  • Barcode reader Inserts R1_X record into Salesforce.

  • Trigger in before insert validates the record and sets the status to 'Approved' or 'Denied'

  • Streaming API push topic (VipLoungeUpdates) captures the record and it is captured in the Visualforce Page via Javascript and the page is rerendered showing the new record information.
  • VF page has subscribed to the push topic VipLoungeUpdates.

-We create push topics each of which is associated with a SOQL query and applications or in our case VF page can suscribe to the push topics, As relevant data is updated in R1_X ,the platform evaluates the query for the push topic and if the result of the query changes then a notification is gonna be sent to the subscribing applications.

This was developed when streaming API was new but I assume it is legacy now. Can the code or functionality be better maintained and developed with its newer versions say CDC or platform Events?

1 Answer 1


The Streaming API is a generic streaming API, the Platform Events system is a specialization that describes an ESB, which uses the Streaming API, and the Change Data Capture is a specialization of PE provided by the system to automatically notify subscribers of changes. In other words, while you could use CDC instead of just Streaming API, the only thing that would really change is your client code would likely be marginally optimized. The Streaming API isn't going anywhere anytime soon, and it certainly is not "legacy" in that sense.


Change events are based on platform events and share some of their characteristics. Change event messages are published to the event bus, where they are stored temporarily for three days. You can retrieve stored event messages from the event bus. Each event message contains the ReplayId field, which identifies the event in the stream and enables replaying the stream after a specific event. For more information, see Message Durability in the Streaming API Developer Guide.

Platform Events:

Use CometD to subscribe to platform events in an external client. Implement your own CometD client or use EMP Connector, an open-source, community-supported tool that implements all the details of connecting to CometD and listening on a channel.

Streaming API:

CometD is a scalable HTTP-based event routing bus that uses an AJAX push technology pattern known as Comet. It implements the Bayeux protocol.

  • If he was building this system from the ground up, would CDC or Platform Events win out? Are there additional costs to CDC/Platform events vs Streaming API? Commented Feb 5, 2020 at 21:48
  • 1
    @BrianMiller If you have Enterprise or higher, all three APIs are included at no extra cost. Professional Edition requires additional subscription cost. The limits for all three APIs are shared, so the choice of which to use is irrelevant from a cost or limits perspective. The limits provided depend on the edition, number of licenses, and any additional Streaming API allocations one purchases.
    – sfdcfox
    Commented Feb 5, 2020 at 22:00
  • Wish I could give more than one up-vote, thank you! For some reason I thought I saw somewhere that CDC was at an additional cost, which is why I've never considered using it Commented Feb 5, 2020 at 22:12
  • Thanks @sfdcfox .So there would not be any performance benefit ? I am asking because with streaming API we see some performance lags and VF page issues and I was wondering if CDCs or PEs are any better when it comes to performance.
    – Chetan
    Commented Feb 6, 2020 at 10:03
  • @Chetan No, there wouldn't be any particular gain; they all run on the same platform, so if you're seeing some lag, it'd apply to any form of the API you'd use. Some investigation would be warranted to figure out why there's lag, as there normally shouldn't be.
    – sfdcfox
    Commented Feb 6, 2020 at 13:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .