{"id":1750,"date":"2026-10-02T13:00:00","date_gmt":"2026-10-02T07:30:00","guid":{"rendered":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/"},"modified":"2026-11-15T21:59:48","modified_gmt":"2026-11-15T16:29:48","slug":"pub-sub-api-salesforce-grpc","status":"publish","type":"post","link":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/","title":{"rendered":"Pub\/Sub API in Salesforce: Stream Events with gRPC"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Pub\/Sub API is Salesforce&#8217;s modern way for outside systems to publish events into Salesforce and subscribe to events coming out of it, in real time. It uses gRPC over HTTP\/2 and sends compact binary messages, so it is fast and efficient. With one API, a system can listen to platform events, Change Data Capture events and more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this post, you will learn topics, schemas, Subscribe and Publish calls, replay IDs and flow control, with a real event example. It builds on <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-platform-events-apex\/\">platform events in Apex<\/a>, <a href=\"https:\/\/swapnilzambare.com\/blog\/change-data-capture-salesforce-apex\/\">Change Data Capture<\/a> and <a href=\"https:\/\/swapnilzambare.com\/blog\/salesforce-integration-patterns\/\">Salesforce Integration Patterns<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is the Pub\/Sub API?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Pub\/Sub API is a gRPC-based API for event streaming. A client connects to a Salesforce endpoint, picks a topic such as \/event\/Payment_Received__e, and then publishes or subscribes. Event payloads use Apache Avro, a binary format described by a schema that the client fetches from the API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Think of a radio station. The station broadcasts on fixed channels, and anyone with a receiver can tune in. Listeners who switch on late can even replay the last few days of shows. Topics are the channels, and replay IDs let a listener pick up where it stopped.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why the Pub\/Sub API Matters<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Real-time integrations need events, not constant polling. Here is why the Pub\/Sub API matters at Bright Path Tutors.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, LearnHub must react within seconds when a payment arrives.<\/li>\n\n<li>Also, the data warehouse wants every change to Course__c as it happens.<\/li>\n\n<li>Next, PayQuick wants to send payment events into Salesforce without Apex.<\/li>\n\n<li>Polling the REST API every minute would waste API requests.<\/li>\n\n<li>Finally, it replaces the older CometD-based Streaming API for new clients.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">So event-driven integrations become faster and cheaper.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How the Pub\/Sub API Works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A typical subscriber follows five steps. First, it gets an OAuth access token and connects to api.pubsub.salesforce.com on port 443 or 7443. Next, it calls GetTopic and GetSchema to learn the event&#8217;s Avro schema. Then it opens a Subscribe stream and asks for a number of events, such as 10. After that, Salesforce sends up to that many events as binary Avro, and the client decodes them. Finally, the client stores the latest replay ID and requests more events when it is ready.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-1-1024x640.png\" alt=\"Pub\/Sub API diagram showing connect, schema, subscribe, receive and replay\" class=\"wp-image-1748\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-1-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-1-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-1-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">How a subscriber streams events safely.<\/figcaption><\/figure>\n\n\n<h3 class=\"wp-block-heading\">gRPC and HTTP\/2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">gRPC is an open source framework for fast calls between services. It runs over HTTP\/2, which keeps one long connection open for streams.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Topics<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A topic is the channel name. For example, platform events use \/event\/Name__e, and change events use \/data\/Course__ChangeEvent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Avro Schemas<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each event type has a schema that describes its fields. So the client fetches the schema once by its ID and uses it to decode payloads.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Subscribe and Publish<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Subscribe streams events to the client, while Publish and PublishStream send events into Salesforce. ManagedSubscribe also lets Salesforce track the replay position for you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Replay IDs and Flow Control<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each event has a replay ID, so a client can restart from LATEST, EARLIEST or a stored ID. Also, the client controls speed by requesting a set number of events at a time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pub\/Sub API Methods at a Glance<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The table below lists the main RPC methods and their jobs.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Method<\/th><th>What it does<\/th><\/tr><\/thead><tbody><tr><td>GetTopic<\/td><td>Checks a topic and the caller&#8217;s access<\/td><\/tr><tr><td>GetSchema<\/td><td>Returns the Avro schema for an event<\/td><\/tr><tr><td>Subscribe<\/td><td>Streams events, with flow control<\/td><\/tr><tr><td>ManagedSubscribe<\/td><td>Streams events, Salesforce tracks replay<\/td><\/tr><tr><td>Publish<\/td><td>Sends a batch of events<\/td><\/tr><tr><td>PublishStream<\/td><td>Sends events over a long stream<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Pub\/Sub API vs Streaming API<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The table below compares it with the older CometD-based Streaming API.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Feature<\/th><th>Pub\/Sub API<\/th><th>Streaming API (CometD)<\/th><\/tr><\/thead><tbody><tr><td>Protocol<\/td><td>gRPC over HTTP\/2<\/td><td>CometD over HTTP\/1.1<\/td><\/tr><tr><td>Payload<\/td><td>Binary Avro<\/td><td>JSON<\/td><\/tr><tr><td>Publish and subscribe<\/td><td>Both in one API<\/td><td>Subscribe only<\/td><\/tr><tr><td>Flow control<\/td><td>Client requests a count<\/td><td>Server pushes<\/td><\/tr><tr><td>Status<\/td><td>Recommended for new work<\/td><td>Older, still supported<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When to use which is simple. Use the Pub\/Sub API for all new external subscribers. Keep CometD only for existing clients until you move them.<\/p>\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-2-1024x640.png\" alt=\"Pub\/Sub API diagram comparing the Pub\/Sub API and the Streaming API\" class=\"wp-image-1749\" srcset=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-2-1024x640.png 1024w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-2-300x188.png 300w, https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-diagram-2-768x480.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Pub\/Sub API vs Streaming API.<\/figcaption><\/figure>\n\n\n<h2 class=\"wp-block-heading\">A Real Pub\/Sub API Example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s connect LearnHub to payments at Bright Path Tutors with the Pub\/Sub API. Salesforce publishes Payment_Received__e, and LearnHub subscribes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Publish the Event in Salesforce<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class PaymentEventPublisher {\n    public static void announce(List&lt;Payment__c&gt; payments) {\n        List&lt;Payment_Received__e&gt; events = new List&lt;Payment_Received__e&gt;();\n        for (Payment__c p : payments) {\n            events.add(new Payment_Received__e(\n                Enrolment_Id__c = p.Enrolment__c,\n                Amount__c = p.Amount__c));\n        }\n        List&lt;Database.SaveResult&gt; results = EventBus.publish(events);\n        for (Database.SaveResult r : results) {\n            if (!r.isSuccess()) {\n                System.debug('Publish failed: ' + r.getErrors()[0].getMessage());\n            }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After a payment is saved, this method publishes one event per payment. Then it checks each result, so failed publishes are visible in the logs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: The Subscriber&#8217;s Fetch Request<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Sent by LearnHub on the Subscribe stream (shown as JSON for reading)\n{\n  \"topic_name\": \"\/event\/Payment_Received__e\",\n  \"replay_preset\": \"CUSTOM\",\n  \"replay_id\": \"&lt;bytes of the last stored replay ID&gt;\",\n  \"num_requested\": 10\n}\n\n\/\/ gRPC metadata headers sent with every call\naccesstoken: &lt;OAuth access token&gt;\ninstanceurl: https:\/\/brightpath.my.salesforce.com\ntenantid: &lt;18-character org ID&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">LearnHub asks for 10 events at a time, starting after the last replay ID it stored. Also, the three headers tell Salesforce who is calling and for which org.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: See the Result<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is what LearnHub&#8217;s log shows after two payments.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Received 2 events (requested 10)\nPayment_Received__e  Enrolment_Id__c=a05Kj00000Qw2Lm  Amount__c=5000  replay=...41\nPayment_Received__e  Enrolment_Id__c=a05Kj00000Qw2Ln  Amount__c=7200  replay=...42\nStored replay ID ...42, activating 2 student accounts<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">LearnHub decoded both events with the Avro schema and saved the newest replay ID. So if it restarts, it continues from event 42 without missing anything.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pub\/Sub API and Event Retention<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">High-volume platform events and change events stay on the event bus for 72 hours. So a subscriber that is offline for a short time can catch up with its replay ID. After 72 hours, the events are gone, so plan alerts for long outages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common Mistakes with the Pub\/Sub API<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Not storing the replay ID, so restarts miss or repeat events.<\/li>\n\n<li>Requesting huge numbers of events and overloading the client.<\/li>\n\n<li>Forgetting the tenantid or instanceurl headers.<\/li>\n\n<li>Decoding payloads without fetching the right schema.<\/li>\n\n<li>Assuming events last forever instead of 72 hours.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for the Pub\/Sub API<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Store the last processed replay ID after each batch.<\/li>\n\n<li>Request a small number of events, then ask for more when ready.<\/li>\n\n<li>Cache schemas by schema ID.<\/li>\n\n<li>Use a dedicated integration user with access only to needed topics.<\/li>\n\n<li>Make subscribers idempotent, because events can arrive more than once.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Practice Task<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Subscribe to \/data\/Course__ChangeEvent with a sample client from Salesforce&#8217;s Pub\/Sub API GitHub examples. Hint: enable Change Data Capture for Course__c first, then update a course and watch the event arrive.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Most Asked Interview Questions on the Pub\/Sub API<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Event-driven questions are growing in senior interviews. Here are the 22 questions asked most about the Pub\/Sub API.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Questions on the Pub\/Sub API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q1: What is the Pub\/Sub API?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a gRPC API, so external systems can publish and subscribe to Salesforce events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q2: Which protocol does it use?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It uses gRPC over HTTP\/2, so one connection carries long streams.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q3: Which format do event payloads use?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">They use binary Apache Avro, so messages stay small.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q4: What is a topic?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is the event channel name, such as \/event\/Payment_Received__e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q5: Which events can you subscribe to?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can subscribe to platform events, change events and some real-time monitoring events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q6: What is the endpoint?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is api.pubsub.salesforce.com, on port 443 or 7443.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q7: How does a client authenticate?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It sends an OAuth access token, the instance URL and the org ID as headers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code and Scenario Questions on the Pub\/Sub API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q8: How do you get the schema of an event?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Call GetSchema with the schema ID from GetTopic or from the event.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q9: How does flow control work?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The client sets num_requested, so Salesforce sends only that many events before waiting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q10: How do you resume after a crash?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Subscribe with replay_preset CUSTOM and the last stored replay ID.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q11: What do LATEST and EARLIEST mean?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">LATEST starts with new events, while EARLIEST starts from the oldest retained event.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q12: How long are events kept?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">High-volume platform events and change events stay for 72 hours.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q13: Can an external system publish events?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, so it calls Publish or PublishStream with Avro-encoded events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q14: What is ManagedSubscribe?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is a subscribe method where Salesforce tracks the replay position for a managed subscription.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Advanced Questions on the Pub\/Sub API<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q15: Why is it preferred over CometD?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It supports both publish and subscribe, uses efficient binary payloads and gives clients flow control.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q16: How do you avoid processing an event twice?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Store processed event IDs or replay IDs, and make updates idempotent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q17: How do you subscribe to changes for one object only?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the object&#8217;s channel, such as \/data\/Course__ChangeEvent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q18: What happens if the subscriber is offline for four days?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It misses events older than 72 hours, so you need a full resync.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q19: How do you limit what a subscriber can read?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Give its integration user access only to the needed objects and events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q20: Does publishing from an outside system run Apex triggers?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, because event triggers subscribe to the same platform event.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q21: How does this API fit integration patterns?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It supports fire and forget and UI updates based on data changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Q22: Which languages can use the Pub\/Sub API?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Any language with gRPC support, such as Java, Python, Node.js or Go.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/platform\/pub-sub-api\/guide\/grpc-api.html\" target=\"_blank\" rel=\"noopener noreferrer\">Pub\/Sub API as a gRPC API (Salesforce Developers)<\/a><\/li>\n\n<li><a href=\"https:\/\/developer.salesforce.com\/docs\/platform\/pub-sub-api\/guide\/pub-sub-endpoints.html\" target=\"_blank\" rel=\"noopener noreferrer\">Pub\/Sub API Endpoints (Salesforce Developers)<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The Pub\/Sub API streams Salesforce events over gRPC.<\/li>\n\n<li>Topics name channels, and Avro schemas describe payloads.<\/li>\n\n<li>Subscribe with flow control, and store the replay ID.<\/li>\n\n<li>Events are kept for 72 hours.<\/li>\n\n<li>External systems can also publish events in.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You have finished Level 9: Integration. Next, read <a href=\"https:\/\/swapnilzambare.com\/blog\/apex-design-patterns\/\">Apex Design Patterns: Singleton, Strategy, Factory and More<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Pub\/Sub API is Salesforce&#8217;s modern way for outside systems to publish events into Salesforce and subscribe to events coming out of it, in&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1747,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[246,8,96],"tags":[68,81,141],"swapz_series":[],"class_list":["post-1750","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-integration-apis","category-salesforce","category-salesforce-developer","tag-advanced","tag-integration","tag-platform-events"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Pub\/Sub API in Salesforce: Stream Events Simply<\/title>\n<meta name=\"description\" content=\"Pub\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&amp;A.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pub\/Sub API in Salesforce: Stream Events Simply\" \/>\n<meta property=\"og:description\" content=\"Pub\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&amp;A.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/\" \/>\n<meta property=\"og:site_name\" content=\"Swapnil Zambare - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-02T07:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-15T16:29:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Swapnil Zambare\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Swapnil Zambare\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/\"},\"author\":{\"name\":\"Swapnil Zambare\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\"},\"headline\":\"Pub\\\/Sub API in Salesforce: Stream Events with gRPC\",\"datePublished\":\"2026-10-02T07:30:00+00:00\",\"dateModified\":\"2026-11-15T16:29:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/\"},\"wordCount\":1563,\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pub-sub-api-salesforce-grpc-featured.png\",\"keywords\":[\"Advanced\",\"Integration\",\"Platform Events\"],\"articleSection\":[\"Integration and APIs\",\"Salesforce\",\"Salesforce Developer\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/\",\"name\":\"Pub\\\/Sub API in Salesforce: Stream Events Simply\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pub-sub-api-salesforce-grpc-featured.png\",\"datePublished\":\"2026-10-02T07:30:00+00:00\",\"dateModified\":\"2026-11-15T16:29:48+00:00\",\"description\":\"Pub\\\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&A.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#primaryimage\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pub-sub-api-salesforce-grpc-featured.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/pub-sub-api-salesforce-grpc-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Pub\\\/Sub API featured image: title card with an integration code example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/pub-sub-api-salesforce-grpc\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pub\\\/Sub API in Salesforce: Stream Events with gRPC\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"name\":\"Swapnil Zambare - Blog\",\"description\":\"Salesforce &amp; Tech Guides\",\"publisher\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#organization\",\"name\":\"Swapnil Zambare - Blog\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"contentUrl\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/site-icon-512.png\",\"width\":512,\"height\":512,\"caption\":\"Swapnil Zambare - Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/theSwapnilZambare\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/#\\\/schema\\\/person\\\/10b09224c8bcc562716e86789427592a\",\"name\":\"Swapnil Zambare\",\"sameAs\":[\"https:\\\/\\\/swapnilzambare.com\\\/blog\"],\"url\":\"https:\\\/\\\/swapnilzambare.com\\\/blog\\\/author\\\/swapnil-zambare\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pub\/Sub API in Salesforce: Stream Events Simply","description":"Pub\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&A.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/","og_locale":"en_US","og_type":"article","og_title":"Pub\/Sub API in Salesforce: Stream Events Simply","og_description":"Pub\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&A.","og_url":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/","og_site_name":"Swapnil Zambare - Blog","article_published_time":"2026-10-02T07:30:00+00:00","article_modified_time":"2026-11-15T16:29:48+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png","type":"image\/png"}],"author":"Swapnil Zambare","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Swapnil Zambare","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#article","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/"},"author":{"name":"Swapnil Zambare","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a"},"headline":"Pub\/Sub API in Salesforce: Stream Events with gRPC","datePublished":"2026-10-02T07:30:00+00:00","dateModified":"2026-11-15T16:29:48+00:00","mainEntityOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/"},"wordCount":1563,"publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png","keywords":["Advanced","Integration","Platform Events"],"articleSection":["Integration and APIs","Salesforce","Salesforce Developer"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/","url":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/","name":"Pub\/Sub API in Salesforce: Stream Events Simply","isPartOf":{"@id":"https:\/\/swapnilzambare.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#primaryimage"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#primaryimage"},"thumbnailUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png","datePublished":"2026-10-02T07:30:00+00:00","dateModified":"2026-11-15T16:29:48+00:00","description":"Pub\/Sub API explained simply: gRPC, topics, Avro schemas, Subscribe and Publish, replay IDs, flow control, CDC events and 22 interview Q&A.","breadcrumb":{"@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#primaryimage","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/11\/pub-sub-api-salesforce-grpc-featured.png","width":2400,"height":1260,"caption":"Pub\/Sub API featured image: title card with an integration code example"},{"@type":"BreadcrumbList","@id":"https:\/\/swapnilzambare.com\/blog\/pub-sub-api-salesforce-grpc\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/swapnilzambare.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Pub\/Sub API in Salesforce: Stream Events with gRPC"}]},{"@type":"WebSite","@id":"https:\/\/swapnilzambare.com\/blog\/#website","url":"https:\/\/swapnilzambare.com\/blog\/","name":"Swapnil Zambare - Blog","description":"Salesforce &amp; Tech Guides","publisher":{"@id":"https:\/\/swapnilzambare.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/swapnilzambare.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/swapnilzambare.com\/blog\/#organization","name":"Swapnil Zambare - Blog","url":"https:\/\/swapnilzambare.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","contentUrl":"https:\/\/swapnilzambare.com\/blog\/wp-content\/uploads\/2026\/09\/site-icon-512.png","width":512,"height":512,"caption":"Swapnil Zambare - Blog"},"image":{"@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.linkedin.com\/in\/theSwapnilZambare"]},{"@type":"Person","@id":"https:\/\/swapnilzambare.com\/blog\/#\/schema\/person\/10b09224c8bcc562716e86789427592a","name":"Swapnil Zambare","sameAs":["https:\/\/swapnilzambare.com\/blog"],"url":"https:\/\/swapnilzambare.com\/blog\/author\/swapnil-zambare\/"}]}},"_links":{"self":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/comments?post=1750"}],"version-history":[{"count":2,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1750\/revisions"}],"predecessor-version":[{"id":3384,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/posts\/1750\/revisions\/3384"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media\/1747"}],"wp:attachment":[{"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/media?parent=1750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/categories?post=1750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/tags?post=1750"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/swapnilzambare.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=1750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}