1) What is the purpose of Salesforce Streaming API?
The Salesforce Streaming API enables real-time data updates using push technology and an event-driven architecture. It operates on an event-based model, allowing applications to subscribe to events and receive updates as they occur in near real-time.
2) What types of events are supported by the Salesforce Streaming API, and in which scenarios should it be used?
Types of Events Supported:
- Generic Events: Legacy, for custom notifications.
- PushTopics: Legacy, for changes in Salesforce records based on SOQL queries.
- Change Data Capture (CDC): For tracking changes to Salesforce data records in real-time.
- Platform Events: For high-volume, custom business event notifications.
When to Use the Streaming API:
Use Streaming API when real-time data updates are required to synchronize external systems with Salesforce data, such as in applications that react immediately to changes in data or business processes.
Note: PushTopics and generic events are legacy products with limited support. For new implementations, use Change Data Capture instead of PushTopics and Platform Events instead of generic events.
3) What are platform events in Salesforce?
Platform events are secure and scalable messages used to enable real-time communication between Salesforce and external apps, as well as within Salesforce itself, using an event-driven messaging architecture.
4) What is the Event Bus in Salesforce?
The event bus is a temporary storage system where platform event messages are published. Events on the bus can be retrieved using a CometD client, and each event contains a ReplayId
field to identify its position in the stream.
5) What are standard platform events, and how can they be used?
Standard platform events, such as AssetTokenEvent
and BatchApexErrorEvent
, are predefined by Salesforce for specific purposes like monitoring authentication or reporting errors. Custom platform events can also be defined and published using Apex, Process Builder, Flow Builder, or APIs, and subscribed to via triggers or external apps.
6) How are platform events published in Salesforce?
Platform events can be published:
- Immediately: Messages are sent as soon as they are generated and cannot be rolled back.
- After Commit: Messages are sent only after a transaction is committed, and they support rollback using
setSavepoint()
androllback()
.
7) What are high-volume platform events, and how are they different from standard-volume events?
High-volume platform events, introduced in API version 45.0, allow for better scalability and can handle millions of events. They are always published asynchronously for efficient processing. Standard-volume events are no longer available for new definitions but are supported for existing implementations.
8) What is the retention period for platform event messages on the event bus?
- High-Volume Events: Retained for 72 hours (3 days).
- Standard-Volume Events: Retained for 24 hours (1 day).
9) What is the ReplayId field in platform event messages?
The ReplayId
field is a system-generated, opaque identifier for an event in the stream. It helps subscribers retrieve missed events during resubscription within the retention window. Replay IDs are not guaranteed to be unique.
No comments:
Post a Comment