0

Where can I find clear docs on the API limits for sending platform events IN to sfdc?

The platform events basics trailhead notes that:

provides allocations for how many events you can define in your org, and how many event records you can publish in an hour. Also, because event publishing is equivalent to a DML insert operation, DML limits and other Apex governor limits apply

The DML part makes sense to me because creating an event is a DB insert.

HOWEVER - where are the docs that clearly cover "how many event records you can publish in an hour". The trailhead points you to Execution governors and limits, but this is where it gets muddy.

Total number of DML statements issued: 150. Does this mean only 150 platform events can be raised across an org per hour?

Or for each Apex transaction, 150 platform events can be raised? Do the producers also get charged 1 Apex Rest API call per event raised?

Given the concrete example below, can someone help me answer ALL the limits that are associated with this flow?

  1. I have a SPA that uses JSForce .sobject().create() to hit /services/data/v40.0/sobjects/Cloud_News__e with the request body defined here. This API call is invoked under a token from a salesforce user with a Enterprise Edition:Partner Community license.
  2. The Apex controller in my SFDC org, handles the event (1 Apex transaction) and updates a custom object.

What are the specific limits associated with this flow?

4

Total number of DML statements issued: 150. Does this mean only 150 platform events can be raised across an org per hour?

No, it means that every single Apex Transaction can do 150 DML statements. It has nothing to do with Platform Events directly (but publishing events costs DML statements for that transaction).

Or for each Apex transaction, 150 platform events can be raised?

You can call EventBus.publish up to 150 times per transaction, but those are shared with all other DML operations, like inserts, updates, deletes, converts, etc. There's a list version of this method that can theoretically publish up to 10,000 events per call (the maximum DML rows limit). As Adrian pointed out, you only get 100,000 events per hour, though.

Do the producers also get charged 1 Apex Rest API call per event raised?

Yes, if you use the REST API, it counts towards your org's daily API limits. This isn't the same as publishing events, however. When possible, use the Composite resource to submit up to 25 events in a batch to reduce the number of API calls you consume.

I have a SPA that uses JSForce .sobject().create() to hit /services/data/v40.0/sobjects/Cloud_News__e with the request body defined here. This API call is invoked under a token from a salesforce user with a Enterprise Edition:Partner Community license.

The Apex controller in my SFDC org, handles the event (1 Apex transaction) and updates a custom object.

It sounds like one event per transaction, then. It would be possible for the Apex Code to publish more events in response to an event, in which case the count would increase.

  • Thanks. Just a clarification - REST API calls are tracked on a per license basis NOT an "org's daily API limits" correct? Said another way, a user logs into my SPA via SFDC User-Agent OAuth flow. They do something in my connected SPA, and I invoke the API using their creds (OAuth token). The end users license (Partner Community for ex) is "charged" 1 API call correct? Or are you saying there is a double-whammy? End user license gets charged AND some org API limit gets charged? – rynop Jul 31 '18 at 21:57
  • @rynop There's no such thing as a per license limit. All of the calls you're entitled to for the license count times license type limits are aggregated into a single number that's the daily org limit. You can use them any way you like. – sfdcfox Jul 31 '18 at 22:27
  • hmm, this page seems to say otherwise: developer.salesforce.com/docs/… . It talks about calls "per lic type" – rynop Aug 1 '18 at 13:58
  • @rynop no, it just desrribes how the org wide limits are calculated. – sfdcfox Aug 1 '18 at 14:01
4

The phrasing is a bit ambiguous in terms of which link you should visit:

For more information see the Resources section.

However, that section does include the below document which I believe answers your questions:

Platform Event Allocations

Maximum number of event notifications published per hour

Performance and Unlimited Editions
100,000

Enterprise Edition
100,000

All other supported editions
100,000

As far as how your publishing impacts governors, within a single transaction each call to publish will count as one DML Statement, and each event included within any of those actions would count as a DML Row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.