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.
Best Answer
Aynchronously
Yes, separate limits from the publishing context
Each Apex subscription trigger executes in its own transaction with independent limits.
To back these claims up I create a test platform event with two Apex trigger subscriptions. I then executed a publish for 300 events via anonymous Apex.
There were 5 independent transaction logs generated. One for the Tooling API execute anonymous, followed by 4 "Platform Event Trigger" operations. Historically each log entry has always represented a separate transaction (with their own limit). I'm assuming the same applies here. I'll add some more limit logging to back that up.
Sequence of logs for my second test attempt:
Operation Platform Event Trigger 1st Apex trigger with CPU Limit at 12 with last DEBUG message. Trigger.new size of 100. Timestamp: 7:57:12 PM
Note how my first test split 200 events to the first event trigger transaction and then 100 events to the latter transactions. Yet in my second test with the same triggers and same number of published events the second trigger only fired once for the full 300 records. Important note on potential Trigger.new size for platform events.
It can potentially go all the way up to 2000 events in one trigger transaction. Source