Monday, 2 May 2022

Salesforce Platform Events

 1.Platform events are a special type of object (__e).

2.Platform events only support create/read permission.

3.No SOQL support,you must replay events to retrieve.

4.Fields limited to base data types only (i.e text,date,number,Boolean).

5.you can subscribe to events via Apex,Process Builder and CometD utility (Java or javascript).


Note :

The what happens with the platform event in an event bus is that you have decoupled your information publishers and your information subscribers.


The publisher of information doesn't have to know anything about anybody that's listening. And the subscriber, 

if it happens to fail or have an exception or something like that doesn't walk anybody else from performing actions. 

That's one of the real powers of this platform event model.


The only way to get events is to subscribe to them and potentially to republish them, 

which has to go through the entire stream events from that point onward.


Platform events cannot be edited their immutable.


Platform events have two publication types :


1.Publish Immediately disregards any form of rollback.

2.Publish On Commit honors transaction controls.



Note :

1.You can publish a platform event immediately, which means it hits that bus and it goes. No matter what else is happening in the system.

2.The second option is to wait until after the committee of the current transaction to publish them. 

If you're trying to do something because if you're trying to throw a platform event because a record change successfully, 

you'd want to wait till after commit But if I have an heir, I wanna publish that thing right away.


Note :

1.'Processes' utilize the SAME user that fired the event.

2.'Triggers' utilize the AUTOMATED PROCESS user.


Asynchronous processing :

=========================

It's now known has changed data capture what happens with change. 

Data capture is any record event that happens on that particular object has a platform event published, 

and the body of that event is the fields that are changed.


Events are processed in batches that can scale up quickly.

-> Monitor limits in the transaction and pick up where you left off 

with TriggerContext.setResumeCheckpoint(replayId).

-> Abort and retry a batch from the beginning by throwing an EventBus.RetryableException.

No comments:

Post a Comment