We are starting to see a high utilization of daily delivered platform events.
We are looking for ways to lower the daily delivered platform event limit. One of the solutions will look into using a criteria filter on the subscribe platform events. We have not seen much documentation on what adding a criteria filter to the subscription can do.
I looked here and I could not find anything about the use of criteria filter: https://developer.salesforce.com/docs/atlas.en-us.platform_events.meta/platform_events/platform_events_subscribe.htm
Can you provide us with documentation on adding a criteria filter?
Here is the example that we are using:
// Define the subscription criteria
const platformEventName = 'My_Platform_Event__e';
const channelName = '/event/' + platformEventName;
const criteria = {
recordTypeId: {
$in: ['012xx0000000000AAA', '012xx0000000000BBB']
}
};
// Subscribe to the platform event with the criteria
subscribe(channelName, -1, (event) => {
// Handle the received event
console.log('Received event: ' + JSON.stringify(event));
}, criteria)
.then(response => {
console.log('Subscribed to channel ' + channelName);
})