Announcing Pub Sub API Generally Available
We’re excited to announce that the Salesforce Pub Sub API is generally available as of June 30th, 2022. Pub Sub API is designed for building event-driven architectures and works with existing eventing features and products like high-volume platform events, Change Data Capture, and Real-Time Event Monitoring. You can learn all about it in this post and see a demo on our YouTube channel.
Pub Sub API has been in a customer pilot since Fall 2021. During that time, we’ve received great feedback from dozens of companies. We’ve also started building products that use Pub Sub API, like Commerce Cloud Order Management.
The origin story
We built Pub Sub API to give customers and internal teams a better way to work with events and take advantage of the new Salesforce Event Bus. Architecturally, what sets Pub Sub API apart is that it runs on a dedicated infrastructure that’s distinct from the REST, SOAP, Bulk, and Streaming APIs that have been used to publish and subscribe to events. This independence enables us to better scale the service to meet customer needs.
Pub Sub innovation
Aside from using a whole new architecture, Pub Sub API also streamlines the experience of building event-driven integrations. We baked several new features into Pub Sub API including:
- Subscription Flow Control. Specify how many events you want a subscriber to receive in a subscribe call. With flow control, if there’s a spike in publish traffic, your external subscribers can fall back in the stream instead of being overwhelmed with more events than they can process.
- Real-Time Publish Acknowledgements. Clients that publish events via Pub Sub API receive a real-time response that the event was successfully published. This improves the visibility of publish operations and enables publish retry mechanisms if needed.
- Publish, Subscribe, and Get Schema via the Same API. Do more with one API.
Pub Sub API is also Salesforce’s first customer-facing gRPC-based API. gRPC is an API format that was originally created by Google for microservice architectures. The key benefits gRPC brings to Pub Sub API are:
- Performance improvements compared to REST
- Support for 11 languages
- HTTP 2 support
- Bidirectional streaming
The power of Pub Sub
All the eventing tools you’re already using work with Pub Sub API. The events you publish to Salesforce with Pub Sub API can be consumed by the Apex, Flow, and LWC subscribers you’ve already built. On the subscription side, if you’ve been using a CometD client to consume events outside of Salesforce with the Streaming API, you can also consume those same events through Pub Sub API.
Pub Sub patterns
A common pattern for event-driven architecture is using Salesforce APIs to connect the Salesforce Event Bus to an external messaging system, like Apache Kafka, RabbitMQ, or Amazon EventBridge. Those messaging systems handle event orchestration and connect external microservices and apps that need to respond to events. Of course, connecting those messaging systems to Salesforce is where Pub Sub API comes in. This LucidChart template illustrates how Pub Sub API can help you connect Salesforce to your messaging systems.
Put Pub Sub API to work
Pub Sub API MuleSoft connector
If MuleSoft is a part of your architecture, you can start using Pub Sub API with the new Pub Sub API connector. The Pub Sub API connector gives developers the benefits of Pub Sub API without having to build a custom client. The new connector is purpose-built for event-driven integration and works alongside the Salesforce Connector. Check out this post on the MuleSoft blog to learn more.
Build your own Pub Sub API client
Developers can start using Pub Sub API by building their own clients. The first step is to head to the developer doc and GitHub repo. We’ve created client code examples in Python and Go and developers can find even more open-source examples on GitHub.
We’re really excited about the future of Pub Sub API. We can’t wait to see what you build and hear how we can make it even easier to build with events.
Here are some resources to help you get started:
- Pub Sub API Developer Documentation
- Pub Sub API GitHub Repo
- MuleSoft Blog
- Salesforce Developers’ Quick Take Video — Introducing the New gRPC-based Pub Sub API
- Salesforce Developers’ Blog — Pub/Sub API: Building Event-Driven Integrations Just Got Even Easier
- Salesforce Developers’ Podcast — Episode 93: Pub Sub API with Emmett Chen-Ran
- Salesforce Developers’ Podcast — Episode 115: Event Relays with Tyson Read
- gRPC