Streaming API Interview Questions test whether you can keep an outside client in step with Salesforce. Anyone can open a subscription, and the hard parts are flow control, replay and what happens after an outage.
Last reviewed for the Winter ’27 release (November 2026).
This post covers the questions asked, grouped into the options, Pub/Sub API, PushTopics and generic events, replay and recovery, and scenario questions where a stream has fallen behind.

Caption: The client asks for events rather than being flooded, which is what flow control means.
What Streaming API Interview Questions Cover
Streaming API Interview Questions start with the choice of channel. Salesforce has several streaming options, and they differ in what they carry and how a client connects.
Think of it like subscribing to a newspaper rather than phoning for the news. The events themselves are defined as described in the post on platform events in Apex. The paper arrives, and you decide how many you can read.
That reading rate is the difference Streaming API Interview Questions care about. The newer API lets a client pull events at its own pace rather than having them pushed at whatever speed they arrive.
The Streaming Options
| Channel type | What it carries |
|---|---|
| PushTopic | Records matching a SOQL query you store |
| Generic event | Anything you publish, with no object involved |
| Platform event | A custom event with fields you defined |
| Change Data Capture | Every change to a tracked object |
| Client option | How it connects |
|---|---|
| Pub/Sub API | gRPC, with flow control and schemas |
| Older streaming endpoints | Long polling over HTTP |
| empApi in a component | The browser, inside Salesforce |
| Event Relay | No client at all, straight into AWS |
Those two tables answer most Streaming API Interview Questions on their own, and the follow up is always which one you would pick.
PushTopic pt = new PushTopic();
pt.Name = 'CourseUpdates';
pt.Query = 'SELECT Id, Name, Fee__c FROM Course__c WHERE Is_Online__c = true';
pt.ApiVersion = 62.0;
pt.NotifyForOperationCreate = true;
pt.NotifyForOperationUpdate = true;
pt.NotifyForFields = 'Referenced';
insert pt;
That NotifyForFields value is the line Streaming API Interview Questions probe, because setting it to All turns every unrelated edit into traffic.
Pub/Sub API vs the Older Endpoints

Caption: New work goes to Pub/Sub API, and the older endpoints remain for existing clients and browser components.
| Need | Pick |
|---|---|
| A new outside subscriber | Pub/Sub API |
| A component inside Salesforce | empApi |
| Events into AWS with nothing to host | Event Relay |
| An existing long polling client | Leave it, and plan a move |
| Control over consumption rate | Pub/Sub API |
Streaming API Interview Questions usually give you a client description and ask which row applies.
The posts on Pub/Sub API and the Streaming API and PushTopics cover both routes.
Streaming API Interview Questions on Pub/Sub API
Q1: What protocol does Pub/Sub API use?
gRPC, a fast protocol over HTTP/2, with payloads encoded in Apache Avro.
It keeps one long lived connection open and streams events both ways, instead of polling.
Interview tip: name both gRPC and Avro. It shows you know how Pub/Sub works underneath.
Q2: Why is that an advantage?
Smaller messages, a defined schema for every event, and streaming built into the protocol.
That means less network use, fewer parsing errors and better performance than the older JSON based streaming.
Follow-up you may get: Is gRPC supported in browsers? Not directly, so Pub/Sub API is for server side clients.
Q3: What is flow control?
The client asks for a set number of events at a time, so it is never flooded.
Example: the client requests 100 events, processes them, then asks for the next 100.
Interview tip: flow control is the headline benefit. Lead with it.
Q4: Why does that matter in practice?
A slow consumer stays stable instead of crashing during a spike.
If a big data load creates 50,000 events, the client takes them in batches it can handle.
Q5: What do you need to connect?
An OAuth access token, the org’s instance URL and the org ID, sent as gRPC metadata headers.
The token usually comes from a connected app using the client credentials or JWT bearer flow.
Follow-up you may get: Which flow suits a server client? Client credentials or JWT bearer.
Q6: How does a client know the payload shape?
It fetches the schema by its ID with the GetSchema call, and decodes each event with it.
Each event carries a schema ID, so the client always knows which version of the shape it is reading.
Q7: Why fetch the schema rather than hard code it?
Because the event definition can change, and a new schema ID tells you when it has.
Cache schemas by ID, and fetch a new one whenever an unknown ID appears, so a new field never breaks the client.
Interview tip: mention caching schemas by ID. It shows production experience.
Q8: Which events can it carry?
Platform events, Change Data Capture events, real time event monitoring events and custom channels.
They all use the same subscribe and publish calls, with topic names like /event/Order_Shipped__e or /data/AccountChangeEvent.
Q9: Can it publish as well as subscribe?
Yes. Clients can publish platform events through the Publish and PublishStream calls as well as subscribe.
One integration can listen for Salesforce changes and send its own events back over the same API.
Follow-up you may get: Can it publish change events? No, Salesforce publishes those itself.
Q10: What happens when the client stops requesting events?
Delivery pauses until the client asks for more, which is how flow control works.
Events are not lost while paused; they wait on the bus within the retention window.
Q11: How does a client resume after a restart?
By subscribing with the last replay ID it successfully handled.
Pub/Sub API also offers managed subscriptions, where Salesforce stores the position for you.
Interview tip: mention managed subscriptions. They are newer and less known.
Q12: What languages can use it?
Any language with a gRPC library, like Java, Python, Node.js, Go and .NET.
Salesforce publishes the proto file and examples in several languages to start from.
Q13: What is the difference between Pub/Sub API and the older Streaming API?
Pub/Sub API uses gRPC with binary Avro payloads, supports flow control, publishing and managed subscriptions, and is faster. The older Streaming API uses CometD long polling with JSON. New integrations should use Pub/Sub API.
Q14: How do you filter events so a subscriber gets only some of them?
Create a custom channel with a filter expression on event fields, like Region__c = ‘West’, and subscribe to that channel. Filtering on the server saves delivery allocations and client work.
Q15: Is it harder to set up than long polling?
There is more initial work, and the reliability pays for it in production.
Salesforce’s example clients help, and once set up, flow control and replay make it far easier to run in production.
Streaming API Interview Questions on PushTopics and Generic Events
Q16: What is a PushTopic?
A record that holds a SOQL query defining which record changes send a message.
Example: a PushTopic with SELECT Id, Name, Status__c FROM Course__c WHERE Status__c = ‘Open’ sends a message when matching courses change.
Follow-up you may get: Where do you create PushTopics? Through Apex or the API, by inserting a PushTopic record.
Q17: What channel does it use?
A channel under /topic/, named after the PushTopic record.
Example: a PushTopic named OpenCourses publishes on /topic/OpenCourses.
Q18: Which operations can it report?
Create, update, delete and undelete, each switched on separately with NotifyForOperationCreate and similar fields.
Turn on only the operations the subscriber needs, to keep traffic low.
Q19: What does NotifyForFields control?
Which field changes send a message.
| Value | Sends a message when |
|---|---|
| All | Any field on the record changes, even ones not in the query |
| Referenced | A field in the SELECT or WHERE changes (the default) |
| Select | A field in the SELECT changes |
| Where | A field in the WHERE clause changes |
Interview tip: recommend Referenced and say why. It is a practical, cost aware answer.
Q20: Which value is the sensible default?
Referenced, so only changes to fields in the query count.
It keeps traffic to what the subscriber actually cares about.
Q21: What happens with All on a busy object?
Every unrelated edit sends a message, which uses up delivery allocations fast.
On an object edited thousands of times a day, All can exhaust the daily limit by mid morning.
Q22: What are the limits on a PushTopic query?
Only simple queries are allowed: no aggregates, no relationships across objects, no ORDER BY or LIMIT, and a limited set of fields.
The query must include Id, and some field types like long text cannot be used in WHERE.
Follow-up you may get: Can a PushTopic query use a formula field? Yes, in SELECT, but with limits in WHERE.
Q23: What is a generic event?
A message with no record behind it, published to a custom streaming channel you create.
Example: a /u/JobFinished channel that tells a dashboard when a nightly job completes.
Q24: When is that useful?
For notifications that have nothing to do with a record, like a job finishing or a cache being refreshed.
Today, a platform event usually does the same job with more structure.
Q25: How do you publish a generic event?
Through the REST endpoint for that streaming channel.
Example: POST to /services/data/v68.0/sobjects/StreamingChannel/{channelId}/push with the message payload.
Q26: Should new work use PushTopics?
Usually not. Platform events and Change Data Capture carry more detail and need no SOQL string.
| Option | What triggers it | Payload | Status |
|---|---|---|---|
| PushTopic | A SOQL query on record changes | Fields from the query | Legacy; maintain only |
| Generic streaming | Your own publish call | Free text | Legacy |
| Platform event | Your publish call | Fields you define | Recommended |
| Change Data Capture | Any change to tracked objects | Changed fields and header | Recommended |
Interview tip: say you would migrate PushTopics, not build new ones.
Q27: How do you migrate a PushTopic to Change Data Capture?
Turn on CDC for the object, update the client to subscribe to /data/ObjectChangeEvent, map the fields from the change event payload, and test both side by side before deleting the PushTopic.
Q28: Can PushTopics be used in a managed package?
Yes, but they are records, not metadata, so the package must create them at install time with Apex. Platform events and change events are metadata and package more cleanly.
Q29: Why do PushTopics still appear in interviews?
Because older integrations use them, and you may have to maintain one.
Knowing them helps you migrate them to platform events or Change Data Capture safely.
Streaming API Interview Questions on Replay and Recovery
Q30: What is a replay id?
A number per event in a channel that lets a client resume from a known point.
The client sends it when subscribing to get everything after that event.
Q31: What does minus one request?
Only new events from the moment of subscription.
Use it for live views where old events do not matter.
Follow-up you may get: Is -1 the default? Yes, if no replay ID is sent.
Q32: What does minus two request?
Every event still in the retention window, then new ones.
Use it for a first sync, but expect a large burst of old events.
Q33: How long are events stored?
Up to 72 hours for platform events and change events. Older PushTopic and generic events are kept for 24 hours.
A client that is down longer than that misses events and needs a reconciliation step.
Q34: When should a client store its replay id?
After the event has been fully processed.
Store it in the same step that saves the result, so the two stay in sync.
Interview tip: give the crash example. It explains the rule better than the rule itself.
Q35: What happens if it stores it first?
A crash skips the event, and the data is silently missing.
The client restarts from the saved ID, which is already past the event it never finished.
Q36: What delivery guarantee applies?
At least once, so handlers must be idempotent.
A repeated event must not create a duplicate record or double a total.
Interview tip: tie “at least once” to idempotency every time.
Q37: Is ordering guaranteed?
Within one channel, yes. Across channels, no.
Design handlers so they do not depend on events from different channels arriving in a set order.
Follow-up you may get: How do you keep order for one record’s changes? Use the same channel, such as that object’s change events.
Q38: What happens after the retention window passes?
The events are gone, so you need a reconciliation query.
Query records changed since the last good sync using LastModifiedDate or SystemModstamp, then process them directly.
Q39: How do you detect that a client has fallen behind?
Compare its stored replay ID and processing time with the latest events, and alert on the gap.
A simple check is the age of the last processed event: if it is more than a few minutes old during working hours, alert.
Q40: What should a client do on a connection drop?
Reconnect with its last replay ID, waiting longer between each attempt.
Example: wait 1 second, then 2, 4, 8, up to a maximum like 60 seconds.
Interview tip: say “exponential backoff with jitter”. It is the term interviewers look for.
Q41: Why is backoff important?
Reconnecting in a tight loop makes an outage worse for everyone.
It can also use up connection and API limits, so the client stays blocked after Salesforce recovers.
Q42: What is a managed event subscription?
A Pub/Sub API feature where Salesforce stores the subscriber’s replay position. The client commits its progress, and on reconnect it continues from there without storing replay IDs itself.
Q43: How many concurrent subscribers can a channel have?
Limits depend on the API and edition, so check the current Pub/Sub API and streaming allocations. Design with a small number of server side subscribers that fan out work, instead of many direct clients.
Q44: What belongs in a streaming client’s monitoring?
Connection state, last replay id, events handled and errors, all visible to someone.
Send these to the team’s monitoring tool, not just a log file, so someone sees problems quickly.
Scenario Based Streaming API Interview Questions
Q45: Scenario: a client crashes during a spike. What design fixes it?
Flow control through the Pub/Sub API, so the client pulls events at its own pace.
Request small batches, process them, then ask for more. A spike then takes longer to clear, but the client stays up.
Q46: Scenario: delivery allocations are exhausted by lunchtime. What do you check?
PushTopics with NotifyForFields set to All, and channels or tracked objects nobody uses.
Switch to Referenced, remove unused PushTopics, and turn off CDC for objects with no subscribers.
Q47: Scenario: a client was offline overnight. How does it catch up?
Resubscribe with its last stored replay ID, as long as it is inside the 72 hour window.
It then receives every event it missed, in order, before new ones.
Q48: Scenario: it was offline for a week. What now?
A reconciliation query against the records, because the events have expired.
Query records changed since the last good sync, process them, then resume streaming from -1.
Interview tip: always add a reconciliation plan to any streaming design.
Q49: Scenario: records are processed twice. Why?
At least once delivery sent the event again, and the handler was not idempotent.
Key each change on the record ID and change time, and skip events already processed.
Q50: Scenario: the client reconnects every second during an outage. What do you add?
Exponential backoff with a cap.
Double the wait after each failed attempt up to a maximum, and add a little random delay so many clients do not reconnect at the same moment.
Q51: Scenario: a payload cannot be decoded after a release. What happened?
The event’s schema changed, and the client used a hard coded shape. Fetch the schema by ID instead.
Cache schemas by ID, and handle unknown IDs by fetching the new schema before decoding.
Q52: Scenario: a component shows duplicate rows. What is missing?
An unsubscribe when the component is destroyed.
Call unsubscribe from lightning/empApi in disconnectedCallback.
Follow-up you may get: Which channel prefix does empApi use for platform events? /event/ followed by the API name.
Q53: Scenario: the business wants events in AWS with nothing to host. What do you propose?
Event Relay, which sends events to Amazon EventBridge with no client to host.
You configure the relay in Salesforce and AWS, and AWS services like Lambda react to the events.
Interview tip: mention Event Relay when AWS comes up. It shows current knowledge.
Q54: Scenario: a partner cannot use gRPC. What do you offer?
The older CometD streaming endpoints, or a webhook style push from a small service you run.
Many languages have CometD clients. A middleware tool like MuleSoft can also subscribe and forward events as HTTP calls.
Q55: Scenario: nobody noticed a stream had stopped for two days. What do you add?
Monitoring on the client, with an alert when the replay ID or the last event time stops moving.
Send a heartbeat metric from the client and alert if nothing is processed for a set time during busy hours.
Q56: Scenario: a dashboard must update when any case changes. What do you build?
Turn on Change Data Capture for Case and subscribe in the LWC with lightning/empApi to /data/CaseChangeEvent, refreshing the list when an event arrives. Unsubscribe in disconnectedCallback.
Q57: Scenario: an integration needs both history and live changes. How do you start it?
Run a one time bulk export of current records first, note the time, then subscribe with -2 or a replay ID from that time so no change in between is missed. Make the handler idempotent so overlaps are safe.
Q58: Scenario: an interviewer asks what makes a streaming integration production ready. What do you say?
Flow control, replay ids stored after success, idempotent handlers, backoff and monitoring.
Flow control, replay IDs stored after success, idempotent handlers, backoff on reconnect, monitoring, and a reconciliation job for long outages.
Common Mistakes Candidates Make
- Assuming the server decides the delivery rate, which Streaming API Interview Questions test directly
- Setting NotifyForFields to All on a busy object
- Storing a replay id before the work succeeds
- Hard coding the payload shape instead of fetching the schema
- Reconnecting with no backoff
- Treating a live connection as proof that events are being handled
More Streaming API Interview Questions
Q59: What is the older CometD based Streaming API?
The original way to receive events, using long polling over the Bayeux protocol. It still works, but Pub/Sub API is the modern choice for new clients.
Q60: What format are Pub/Sub API payloads in?
Apache Avro, a compact binary format. The client uses the event schema to decode each message.
Q61: How does a Lightning Web Component receive events?
Through the lightning/empApi module, which subscribes to a channel and calls a function for each message.
Q62: What does a change event header tell you?
The change type, the object, the record ids, the fields that changed, the commit time and the transaction key.
Q63: How do you choose which objects send change events?
In Setup, on the Change Data Capture page, by moving the objects you want into the selected list.
Each selected object gets its own change event channel, like /data/AccountChangeEvent. Select only objects that have a subscriber, to save delivery allocations.
Q64: What is a custom channel?
A channel that groups chosen events and can apply filters, so a subscriber only receives the messages it needs.
Follow-up you may get: How do you create a custom channel? With PlatformEventChannel metadata and channel member records.
Q65: What is a gap event?
A change event that says changes happened but could not be fully described, for example in a very large transaction. The client should re-read those records.
Q66: What is an event relay?
A setup that sends platform events or change events to Amazon EventBridge, so AWS services can react without a custom client.
Q67: What is the difference between Publish After Commit and Publish Immediately?
After Commit sends the event only if the transaction succeeds. Immediately sends it straight away, even if the transaction later rolls back.
Q68: When is Publish Immediately the right choice?
For logging or monitoring events that must survive a failed transaction, such as an error log.
Q69: How do you publish a platform event from Apex?
Create the event record and call EventBus.publish, then check the results for errors.
Q70: Can a flow receive platform events?
Yes. A platform event triggered flow runs for each message on the chosen event.
Q71: What limits apply to events?
Hourly publishing limits and daily delivery allocations, which depend on edition and add ons. Check the current limits for your org before designing.
Q72: How do you monitor event usage?
Query the PlatformEventUsageMetric object, which reports publishing and delivery counts over time.
Q73: What is real time event monitoring?
A Shield feature that streams security and usage events, like logins and report exports, so you can react quickly, for example by blocking a suspicious export. It uses the same streaming channels as other events.
Q74: How do you test a streaming client before go live?
Point it at a sandbox, publish test events, stop the client during a run to check replay works, send duplicates to check idempotency, and simulate a long outage to test reconciliation.
Q75: Scenario: a client misses changes during a bulk load. What do you check?
Look for gap events, compare the client’s last stored replay id with the retention window, and re-read affected records if needed.
Look for gap events, compare the client’s last stored replay ID with the retention window, and check whether the client fell behind during the load.
Best Practices to Mention in an Interview
- Prefer Pub/Sub API for new outside clients
- Request events at a rate the client can handle
- Store the replay id only after processing succeeds
- Make every handler safe to run twice
- Reconnect with exponential backoff
- Monitor the replay id gap and alert on it
- Add a reconciliation job for anything that must not be lost
Official Resources
Quick Recap
- Streaming API Interview Questions begin with the choice of channel and client
- Pub/Sub API adds flow control, schemas and a compact payload
- PushTopics are query based and suit maintenance rather than new work
- Replay ids are the recovery mechanism, stored after success
- Delivery is at least once, so handlers must be idempotent
- Monitoring the replay id gap is what catches a stalled stream
What Is Next
Coming soon: Bulk API interview questions with Composite and GraphQL.


